diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2014-03-21 08:34:47 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-21 17:25:13 (GMT) |
commit | 65656e03896d12c6dbc37a2ae7d30ec257c26092 (patch) | |
tree | 61577b559b2f92f4a9d1f5ffa5861f0bf8eaf796 /src/gui | |
parent | d826d7882b8f4e0b05c7c443b3409481db914a4d (diff) | |
download | Qt-65656e03896d12c6dbc37a2ae7d30ec257c26092.zip Qt-65656e03896d12c6dbc37a2ae7d30ec257c26092.tar.gz Qt-65656e03896d12c6dbc37a2ae7d30ec257c26092.tar.bz2 |
QPushButton: draw label using the stylesheet's font.
The RenderRule for the stylesheet has the correct font information, it
just wasn't being set on the painter that draws the label.
This is a backport of the Qt 5 commit:
9ad768fd1999780df18551151b9d9fa9c354131c.
Task-number: QTBUG-8990
Change-Id: I4857d6e17b62980782ca7bfdfd0a571a9950f635
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/styles/qstylesheetstyle.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index bbda15b..61fdbcf 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3378,6 +3378,11 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) { QStyleOptionButton butOpt(*button); rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); + + const QFont oldFont = p->font(); + if (rule.hasFont) + p->setFont(rule.font); + if (rule.hasPosition() && rule.position()->textAlignment != 0) { Qt::Alignment textAlignment = rule.position()->textAlignment; QRect textRect = button->rect; @@ -3450,6 +3455,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } else { ParentStyle::drawControl(ce, &butOpt, p, w); } + + if (rule.hasFont) + p->setFont(oldFont); } return; |