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 00c9ec63a5
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>
This commit is contained in:
parent
6fdf398ab4
commit
8ad9bdf957
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user