Style sheets: detect and use font set on QHeaderViews
We also ask the parent style to draw the header label instead of the base style which is more likely to respect other text related parameters. Change-Id: I6dd658fa4d016a76d7c450478dc42f07e4b807c4 Task-number: QTBUG-33855 Task-number: QTBUG-37153 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
e413874467
commit
a4e6117c53
@ -3837,7 +3837,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
||||
if(hasStyleRule(w, PseudoElement_HeaderViewSection)) {
|
||||
QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);
|
||||
if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw()
|
||||
|| subRule.hasBackground() || subRule.hasPalette()) {
|
||||
|| subRule.hasBackground() || subRule.hasPalette() || subRule.hasFont) {
|
||||
ParentStyle::drawControl(ce, opt, p, w);
|
||||
return;
|
||||
}
|
||||
@ -3874,12 +3874,14 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
|
||||
QStyleOptionHeader hdr(*header);
|
||||
QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection);
|
||||
subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button);
|
||||
QFont oldFont = p->font();
|
||||
if (subRule.hasFont)
|
||||
if (subRule.hasFont) {
|
||||
QFont oldFont = p->font();
|
||||
p->setFont(subRule.font.resolve(p->font()));
|
||||
baseStyle()->drawControl(ce, &hdr, p, w);
|
||||
if (subRule.hasFont)
|
||||
ParentStyle::drawControl(ce, &hdr, p, w);
|
||||
p->setFont(oldFont);
|
||||
} else {
|
||||
baseStyle()->drawControl(ce, &hdr, p, w);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user