diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-03 19:36:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-12-08 07:25:32 +0000 |
commit | 25231c40489e54d57998fa44385ad832cc32b30d (patch) | |
tree | 4497ebd4c8d621d54f4185b754603a9bdd9b6e26 /src/widgets/styles | |
parent | c4ee12589122923e680e8dd359c30f6dde370f54 (diff) |
QToolButton: Don't elide text if an icon is present
The previous fix which adds an automatic text elision when the
QToolButton is not large enough brought up an inconsistency between
QToolButton::sizeHint() and QCommonStyle::drawControl().
Fix it by syncing the magic numbers between QToolButton::sizeHint() and
QCommonStyle::drawControl().
Fixes: QTBUG-72226
Change-Id: If4a76792cb97bcdb918e18c6b29cb637730acec0
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index bb623d9c04..10dfad2754 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1654,7 +1654,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, alignment |= Qt::TextHideMnemonic; if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { - pr.setHeight(pmSize.height() + 6); + pr.setHeight(pmSize.height() + 4); //### 4 is currently hardcoded in QToolButton::sizeHint() tr.adjust(0, pr.height() - 1, 0, -1); pr.translate(shiftX, shiftY); if (!hasArrow) { @@ -1664,7 +1664,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } alignment |= Qt::AlignCenter; } else { - pr.setWidth(pmSize.width() + 8); + pr.setWidth(pmSize.width() + 4); //### 4 is currently hardcoded in QToolButton::sizeHint() tr.adjust(pr.width(), 0, 0, 0); pr.translate(shiftX, shiftY); if (!hasArrow) { |