From a4e6117c53c3984585b3bbb74c00d6d863c98fcd Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 17 Dec 2015 16:29:08 -0800 Subject: 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) --- src/widgets/styles/qstylesheetstyle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index c4fc353803..cdeb6a5768 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -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; -- cgit v1.2.3