diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2018-05-29 13:27:19 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2018-05-29 14:37:40 +0000 |
commit | ac0db4dc3b595994f60a3026a00ec0b2f33395dc (patch) | |
tree | 675baaeafdab118e413f579ddbf899ed89177f91 | |
parent | a5f83fb66eb10d20f47a56da74c67bd7b3dda8df (diff) | |
download | qt-creator-ac0db4dc3b595994f60a3026a00ec0b2f33395dc.tar.gz |
Core: Fix icon size calculation in the mode bar (Icon + text mode)
This amends 768f0a6209392e3d6ce248c5b92c12d2fe711976 . The order of
setting a painter font and using the fontmetrics of the painter font got
swapped, and therefore the size calculations were done with a wrong
font.
Task-number: QTCREATORBUG-20404
Change-Id: I98d1fbbbf467ded1dc0288784036595976b46e10
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/plugins/coreplugin/fancytabwidget.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index 0bd3920ed6..a905002921 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -293,6 +293,11 @@ static void paintIconAndText(QPainter *painter, const QRect &rect, const QIcon &icon, const QString &text, bool enabled, bool selected) { + QFont boldFont(painter->font()); + boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setBold(true); + painter->setFont(boldFont); + const bool drawIcon = rect.height() > 36; if (drawIcon) { const int textHeight = @@ -322,10 +327,6 @@ static void paintIconAndText(QPainter *painter, const QRect &rect, painter->translate(0, -1); QRect tabTextRect(rect); tabTextRect.translate(0, drawIcon ? -2 : 1); - QFont boldFont(painter->font()); - boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); - boldFont.setBold(true); - painter->setFont(boldFont); const int textFlags = Qt::AlignCenter | (drawIcon ? Qt::AlignBottom : Qt::AlignVCenter) | Qt::TextWordWrap; painter->drawText(tabTextRect, textFlags, text); |