From 9ad768fd1999780df18551151b9d9fa9c354131c Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 20 Mar 2014 13:54:03 +0100 Subject: 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 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstylesheetstyle.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/widgets/styles/qstylesheetstyle.cpp') 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(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; -- cgit v1.2.3