summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-03-11 14:01:28 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-11 23:35:53 +0000
commit1c0c2c4dedfb0ac4ab1951afe2c6b332368f6d6c (patch)
tree89e80cd167cfee4df7d2bd9d595ba32cb32c408b /src
parente36aa59a17b050646f9f7b7ae86e7bf551b3b52a (diff)
Revert "QPushButton: fix support of style sheet rule for text alignment"
This reverts commit 6269438af95bbd988ead08829fa3bc9dc25891e8, and adds a test. This change introduced QTBUG-91735, without fixing QTBUG-86857 correctly. The code already interprets the textAlignment values from the rule, also if no icon is set. Adding the same, or some default textAlignment to the text flags if there is no icon doesn't work. Fixes: QTBUG-91735 Task-number: QTBUG-86857 Change-Id: Iee07e63a40e72909275f32e1caa28b33a595f879 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 674747bac1c8b57d4940de2ee68b6b562dfcad61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index e7662ba5c6..402f664252 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3569,8 +3569,8 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
const uint horizontalAlignMask = Qt::AlignHCenter | Qt::AlignLeft | Qt::AlignRight;
const uint verticalAlignMask = Qt::AlignVCenter | Qt::AlignTop | Qt::AlignBottom;
- const Qt::Alignment textAlignment = rule.position()->textAlignment;
- if (rule.hasPosition() && textAlignment != 0) {
+ if (rule.hasPosition() && rule.position()->textAlignment != 0) {
+ Qt::Alignment textAlignment = rule.position()->textAlignment;
tf |= (textAlignment & verticalAlignMask) ? (textAlignment & verticalAlignMask) : Qt::AlignVCenter;
tf |= (textAlignment & horizontalAlignMask) ? (textAlignment & horizontalAlignMask) : Qt::AlignHCenter;
if (!styleHint(SH_UnderlineShortcut, button, w))
@@ -3629,8 +3629,6 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w),
pixelMetric(PM_ButtonShiftVertical, opt, w));
p->drawPixmap(iconRect, pixmap);
- }else {
- tf |= textAlignment;
}
if (button->state & (State_On | State_Sunken))