summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-02-01 22:04:09 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-02-06 18:00:26 +0100
commitf9cd8fef5e9062f6bd23d70693f4dfb7e32efc78 (patch)
tree0c5b9d65dbaa9962cb1c93816689768e2e4c99a9 /src/widgets/styles
parentef7773e5664dd8278831ed4d7d24dd4fc1aaefd3 (diff)
QPushButton: fix text truncating when icon+text+menu is drawn
When a QPushButton has an icon, text and menu, the text is truncated. In RTL mode the menu indicator is also drawn on the wrong side. Fixes: QTBUG-81784 Change-Id: I27ecb67d12c68ac939540f0f836b2e2875706b4b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/styles')
-rw-r--r--src/widgets/styles/qcommonstyle.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index bc423187d2..9fa00b8d3f 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1350,6 +1350,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
QRect ir = btn->rect;
QStyleOptionButton newBtn = *btn;
newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6);
+ newBtn.rect = visualRect(btn->direction, br, newBtn.rect);
proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
}
}
@@ -1378,7 +1379,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint()
if (!button->text.isEmpty()) {
int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width();
- labelWidth += (textWidth + iconSpacing);
+ labelWidth += (textWidth + iconSpacing * 2);
}
QRect iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2,