QPushButton: fix support of style sheet rule for text alignment
Fixes: QTBUG-86857 Change-Id: I7e3e2b5323b1e46f572cacfddae20cb6e7882a47 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6269438af95bbd988ead08829fa3bc9dc25891e8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
cfa83bbc15
commit
cc785b9b68
@ -3555,8 +3555,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::AlignLeft;
|
||||
|
||||
if (rule.hasPosition() && rule.position()->textAlignment != 0) {
|
||||
Qt::Alignment textAlignment = rule.position()->textAlignment;
|
||||
const Qt::Alignment textAlignment = rule.position()->textAlignment;
|
||||
if (rule.hasPosition() && textAlignment != 0) {
|
||||
tf |= (textAlignment & verticalAlignMask) ? (textAlignment & verticalAlignMask) : Qt::AlignVCenter;
|
||||
tf |= (textAlignment & horizontalAlignMask) ? (textAlignment & horizontalAlignMask) : Qt::AlignHCenter;
|
||||
if (!styleHint(SH_UnderlineShortcut, button, w))
|
||||
@ -3615,6 +3615,8 @@ 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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user