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>
This commit is contained in:
parent
ff0e7df477
commit
9ad768fd19
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user