diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-05 06:39:30 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-05 13:57:12 +0200 |
commit | 657c2bfbeceda3faa2c7a76b4ccec6a65a3445a2 (patch) | |
tree | 83e0a1dab04afb291e181bb8fb6152ba96678795 /src/widgets/styles/qstylesheetstyle.cpp | |
parent | 676129d7ee57347798683d444823e7723776d8ec (diff) | |
parent | b94111116f09a6e48741d35cf7abea47af99ef26 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
tests/auto/testlib/selftests/generate_expected_output.py
Change-Id: If856162abf9a24ae2c9946d336a7d1da03520fa7
Diffstat (limited to 'src/widgets/styles/qstylesheetstyle.cpp')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 4cf77b7a1e..e8e99a4386 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3818,6 +3818,13 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q ParentStyle::drawControl(ce, opt, p, w); return; } + if (subRule.hasFont) { + const QFont oldFont = p->font(); + p->setFont(subRule.font.resolve(p->font())); + baseStyle()->drawControl(ce, opt, p, w); + p->setFont(oldFont); + return; + } } break; case CE_HeaderSection: @@ -4931,13 +4938,14 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op case CT_HeaderSection: { if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); - if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder()) { + if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) { sz = subRule.adjustSize(csz); if (!subRule.hasGeometry()) { QSize nativeContentsSize; bool nullIcon = hdr->icon.isNull(); int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, w); - QSize txt = hdr->fontMetrics.size(0, hdr->text); + const QSize txt = subRule.hasFont ? QFontMetrics(subRule.font).size(0, hdr->text) + : hdr->fontMetrics.size(0, hdr->text); nativeContentsSize.setHeight(qMax(iconSize, txt.height())); nativeContentsSize.setWidth(iconSize + txt.width()); sz = sz.expandedTo(nativeContentsSize); |