From 8591b89807c7db7e09504b623cfb5af3a9c65705 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Thu, 26 Jan 2012 13:06:30 +0100 Subject: [PATCH] Ensure consistent size of facnyactionbar button Otherwise the button can jump on switching projects. Change-Id: I2b6d0a5afe5fc54933fe31d381a312cce896361e Reviewed-by: Tobias Hunger --- src/plugins/coreplugin/fancyactionbar.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 8a49772ce86..a4647456642 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -200,9 +200,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event) if (!projectName.isNull()) centerRect.adjust(0, lineHeight + 4, 0, 0); - const QString buildConfiguration = defaultAction()->property("subtitle").toString(); - if (!buildConfiguration.isNull()) - centerRect.adjust(0, 0, 0, -lineHeight*2 - 4); + centerRect.adjust(0, 0, 0, -lineHeight*2 - 4); iconRect.moveCenter(centerRect.center()); Utils::StyleHelper::drawIconWithShadow(icon(), iconRect, &painter, isEnabled() ? QIcon::Normal : QIcon::Disabled); @@ -237,6 +235,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event) buildConfigRect[1] = QRectF(0, textOffset.y() + 5 + lineHeight, rect().width(), lineHeight); painter.setFont(boldFont); QVector splitBuildConfiguration(2); + const QString buildConfiguration = defaultAction()->property("subtitle").toString(); if (boldFm.width(buildConfiguration) <= availableWidth) { // text fits in one line splitBuildConfiguration[0] = buildConfiguration; @@ -295,9 +294,7 @@ QSize FancyToolButton::sizeHint() const if (!projectName.isEmpty()) buttonSize += QSizeF(0, lineHeight + 2); - const QString buildConfiguration = defaultAction()->property("subtitle").toString(); - if (!buildConfiguration.isEmpty()) - buttonSize += QSizeF(0, lineHeight*2 + 2); + buttonSize += QSizeF(0, lineHeight*2 + 2); } return buttonSize.toSize(); }