summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-12-17 16:29:08 -0800
committerGabriel de Dietrich <gabriel.dedietrich@qt.io>2018-04-24 18:27:34 +0000
commita4e6117c53c3984585b3bbb74c00d6d863c98fcd (patch)
tree9f6a9d1c6693fe4a4042c64217089e9810c79930 /src/widgets/styles/qstylesheetstyle.cpp
parente413874467c01cff63bb53e630d1e5d9d19fda53 (diff)
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>
Diffstat (limited to 'src/widgets/styles/qstylesheetstyle.cpp')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp12
1 files changed, 7 insertions, 5 deletions
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;