summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-08-25 22:39:38 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-08-30 04:25:19 +0000
commit9a3bdbf40af7e4915ed343c8e9917a0f3f54e0ae (patch)
treee1d6f391bdb8281a5a83614dc93ed1888791d13e /src
parentd2c05b0c8557625ce45cdbd98ebf102972d2c2f4 (diff)
QSS/QTabBar: properly handle QTabBar::scroller
PM_TabBarScrollButtonWidth used the size of the ::scroller subcontrol without considering that there are two QToolButtons and therefore returned the wrong size for a single QToolButton. QStyleSheetStyle::subElementRect() had no handling for SE_TabBarScrollLeft/RightButton and therefore the values for the scroller toolbuttons set via the stylesheet were never used. Fix it by dividing the scroller width by two and add the code path to handle SE_TabBarScrollLeft/RightButton in QStyleSheetStyle::subElementRect Task-number: QTBUG-69653 Change-Id: I1adfe6333f3183bba621bbbb4d10969920c6cd46 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index fccc4f33a2..3e55bdaabc 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4853,13 +4853,12 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
return 0;
break;
- case PM_TabBarScrollButtonWidth: {
+ case PM_TabBarScrollButtonWidth:
subRule = renderRule(w, opt, PseudoElement_TabBarScroller);
if (subRule.hasContentsSize()) {
QSize sz = subRule.size();
- return sz.width() != -1 ? sz.width() : sz.height();
+ return (sz.width() != -1 ? sz.width() : sz.height()) / 2;
}
- }
break;
case PM_TabBarTabShiftHorizontal:
@@ -5918,6 +5917,12 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c
}
break;
+ case SE_TabBarScrollLeftButton:
+ case SE_TabBarScrollRightButton:
+ if (hasStyleRule(w, PseudoElement_TabBarScroller))
+ return ParentStyle::subElementRect(se, opt, w);
+ break;
+
case SE_TabBarTearIndicator: {
QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTear);
if (subRule.hasContentsSize()) {