summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2014-03-20 13:54:03 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-20 16:47:22 +0100
commit9ad768fd1999780df18551151b9d9fa9c354131c (patch)
tree3c6ef25c99ee1d48396fe70af0ab39b3bc04aafd
parentff0e7df477ac8400c1fde8c477d721c01d949175 (diff)
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. Task-number: QTBUG-8990 Change-Id: I7cbaffc570421db04ebf3254cb6a21a68f7b868b Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 6bd0ba37c8..94f8e36235 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3382,6 +3382,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;
@@ -3454,6 +3459,9 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
} else {
ParentStyle::drawControl(ce, &butOpt, p, w);
}
+
+ if (rule.hasFont)
+ p->setFont(oldFont);
}
return;