From f9cd8fef5e9062f6bd23d70693f4dfb7e32efc78 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 1 Feb 2020 22:04:09 +0100 Subject: 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 --- src/widgets/styles/qcommonstyle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/widgets/styles') 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, -- cgit v1.2.3