summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-02 09:51:47 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-02 09:56:45 (GMT)
commite1a08048f29174c01e289a4f608aaa283819c5d5 (patch)
tree0f4611b9cf5c6d6592aa04c4b9c28c1624233735 /src/gui/styles/qstylesheetstyle.cpp
parenta3dbe4c00062ad78c924162841cc2d83709b1ea4 (diff)
downloadQt-e1a08048f29174c01e289a4f608aaa283819c5d5.zip
Qt-e1a08048f29174c01e289a4f608aaa283819c5d5.tar.gz
Qt-e1a08048f29174c01e289a4f608aaa283819c5d5.tar.bz2
QStyleSheetStyle: fixes QPushButton { text-alignement:top }
The vertial alignement was correctly set later in the function but Qt::AlignVCenter was always set, conflicting with the flags from textAlignment Reviewed-by: Gabriel Task-number: QTBUG-5110 Task-number: 240367
Diffstat (limited to 'src/gui/styles/qstylesheetstyle.cpp')
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 2d90aa1..2ae9f6a 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -3370,7 +3370,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (rule.hasPosition() && rule.position()->textAlignment != 0) {
Qt::Alignment textAlignment = rule.position()->textAlignment;
QRect textRect = button->rect;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
+ uint tf = Qt::TextShowMnemonic;
+ const uint verticalAlignMask = Qt::AlignVCenter | Qt::AlignTop | Qt::AlignLeft;
+ tf |= (textAlignment & verticalAlignMask) ? (textAlignment & verticalAlignMask) : Qt::AlignVCenter;
if (!styleHint(SH_UnderlineShortcut, button, w))
tf |= Qt::TextHideMnemonic;
if (!button->icon.isNull()) {