summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2018-11-18 13:41:52 +0100
committerLiang Qi <liang.qi@qt.io>2018-11-19 11:45:24 +0000
commit8ad9bdf9578d2879d7484c61cf9a46a667f642a4 (patch)
tree9ec35ebdcd5fa67319f0e2391a94141d12c61e00 /src
parent6fdf398ab4b32c7a70af08191963c4e4f5a885fe (diff)
QScrollBar: fix horizontal scrollbars in RTL mode
When a QScrollBar had a stylesheet the subControlRect() was not properly mirrored which lead to a wrong scrolling behavior. Fix it by adjusting the resulting rect with visualRect(). This reverts 00c9ec63a552d040e851b561c11428fabf1a2b08 since it did not completely fixed the issue for all use cases. Fixes: QTBUG-27279 Fixes: QTBUG-38748 Fixes: QTBUG-40443 Change-Id: I19718287be7b4cfc9dbe6951fff99ae48264a855 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index fe6a4d0e40..96c6fdf2e2 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -5632,22 +5632,18 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
} else {
sliderlen = maxlen;
}
- const int sliderPosition = sb->orientation == Qt::Horizontal && sb->direction == Qt::RightToLeft ? sb->maximum - sb->sliderPosition + sb->minimum : sb->sliderPosition;
int sliderstart = (styleOptionSlider.orientation == Qt::Horizontal ? contentRect.left() : contentRect.top())
- + sliderPositionFromValue(sb->minimum, sb->maximum, sliderPosition,
+ + sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition,
maxlen - sliderlen, sb->upsideDown);
QRect sr = (sb->orientation == Qt::Horizontal)
? QRect(sliderstart, contentRect.top(), sliderlen, contentRect.height())
: QRect(contentRect.left(), sliderstart, contentRect.width(), sliderlen);
- if (sc == SC_ScrollBarSlider) {
- return sr;
- } else if (sc == SC_ScrollBarSubPage) {
- return QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight());
- } else { // SC_ScrollBarAddPage
- return QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight());
- }
- break;
+ if (sc == SC_ScrollBarSubPage)
+ sr = QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight());
+ else if (sc == SC_ScrollBarAddPage)
+ sr = QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight());
+ return visualRect(styleOptionSlider.direction, grooveRect, sr);
}
case SC_ScrollBarAddLine: pe = PseudoElement_ScrollBarAddLine; break;
case SC_ScrollBarSubLine: pe = PseudoElement_ScrollBarSubLine; break;