From e1a08048f29174c01e289a4f608aaa283819c5d5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 2 Nov 2009 10:51:47 +0100 Subject: 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 --- src/gui/styles/qstylesheetstyle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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()) { -- cgit v0.12