From: Flavio Tordini Date: Mon, 3 Aug 2015 12:27:58 +0000 (+0200) Subject: More space for title text X-Git-Tag: 2.5~52 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9fe8687578e155f097abdeb4839f07255273fbe8;p=minitube More space for title text --- diff --git a/src/sidebarheader.cpp b/src/sidebarheader.cpp index b4ab622..b6fb87a 100644 --- a/src/sidebarheader.cpp +++ b/src/sidebarheader.cpp @@ -22,7 +22,7 @@ $END_LICENSE */ #include "iconutils.h" #include "mediaview.h" #include "videosource.h" -#include "iconutils.h" +#include "fontutils.h" SidebarHeader::SidebarHeader(QWidget *parent) : QToolBar(parent) { } @@ -57,8 +57,8 @@ void SidebarHeader::setup() { addWidget(spacerWidget); } -QSize SidebarHeader::minimumSizeHint (void) const { - return(QSize(160, QFontMetrics(font()).height() * 1.9)); +QSize SidebarHeader::minimumSizeHint() const { + return QSize(160, QFontMetrics(font()).height() * 1.9); } void SidebarHeader::updateInfo() { @@ -121,13 +121,14 @@ void SidebarHeader::paintEvent(QPaintEvent *event) { if (title.isEmpty()) return; QPainter p(this); p.setPen(Qt::white); + p.setFont(FontUtils::small()); const QRect r = rect(); QString t = title; QRect textBox = p.boundingRect(r, Qt::AlignCenter, t); int i = 1; - static const int margin = 50; + const int margin = forwardAction->isVisible() ? 45 : 20; while (textBox.width() > r.width() - margin*2 && t.length() > 3) { t = t.left(t.length() - i).trimmed() + QLatin1String("..."); textBox = p.boundingRect(r, Qt::AlignCenter, t); diff --git a/src/sidebarheader.h b/src/sidebarheader.h index c0713f1..db16ace 100644 --- a/src/sidebarheader.h +++ b/src/sidebarheader.h @@ -46,7 +46,7 @@ private: void setTitle(const QString &title); QAction *backAction; - QAction * forwardAction; + QAction *forwardAction; QString title; QList videoSourceActions; };