forked from qt-creator/qt-creator
Ensure consistent size of facnyactionbar button
Otherwise the button can jump on switching projects. Change-Id: I2b6d0a5afe5fc54933fe31d381a312cce896361e Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
committed by
Eike Ziller
parent
d3f889df7d
commit
8591b89807
@@ -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<QString> 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user