From 081ff207229835ca61bce2d86b7827eae78b3c4e Mon Sep 17 00:00:00 2001 From: David Rosca Date: Fri, 16 Mar 2018 21:16:57 +0100 Subject: [PATCH] FancyTabWidget: Don't draw tab title This hides tab text in BrowsingLibrary as it would often get elided due to insufficient space in tab bar. It's not possible to resize the tab bar to fit the tab text as the text can be very long depending on translation, so the only way to solve it is to just hide the text. --- src/lib/3rdparty/fancytabwidget.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/3rdparty/fancytabwidget.cpp b/src/lib/3rdparty/fancytabwidget.cpp index e916ea228..582b1571f 100644 --- a/src/lib/3rdparty/fancytabwidget.cpp +++ b/src/lib/3rdparty/fancytabwidget.cpp @@ -416,7 +416,7 @@ void FancyTabBar::paintTab(QPainter* painter, int tabIndex) const painter->drawLine(rect.bottomLeft() + QPoint(0, -1), rect.bottomRight() - QPoint(0, 1)); } - QString tabText(painter->fontMetrics().elidedText(this->tabText(tabIndex), Qt::ElideMiddle, width())); + // QString tabText(painter->fontMetrics().elidedText(this->tabText(tabIndex), Qt::ElideMiddle, width())); QRect tabTextRect(tabRect(tabIndex)); QRect tabIconRect(tabTextRect); tabIconRect.adjust(+4, +4, -4, -4); @@ -426,8 +426,8 @@ void FancyTabBar::paintTab(QPainter* painter, int tabIndex) const boldFont.setBold(true); painter->setFont(boldFont); painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110)); - int textFlags = Qt::AlignCenter | Qt::AlignBottom; - painter->drawText(tabTextRect, textFlags, tabText); + // int textFlags = Qt::AlignCenter | Qt::AlignBottom; + // painter->drawText(tabTextRect, textFlags, tabText); painter->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor()); #ifndef Q_OS_MACOS if (!selected) { @@ -447,12 +447,12 @@ void FancyTabBar::paintTab(QPainter* painter, int tabIndex) const } #endif - const int textHeight = painter->fontMetrics().height(); - tabIconRect.adjust(0, 4, 0, -textHeight); + // const int textHeight = painter->fontMetrics().height(); + tabIconRect.adjust(0, 6, 0, -6); Utils::StyleHelper::drawIconWithShadow(tabIcon(tabIndex), tabIconRect, painter, selected ? QIcon::Selected : QIcon::Normal); painter->translate(0, -1); - painter->drawText(tabTextRect, textFlags, tabText); + // painter->drawText(tabTextRect, textFlags, tabText); painter->restore(); }