Skip to content

Commit 616d33c

Browse files
committed
Windows11Style: simplify subControlRect for CC_ScrollBar
The branches for SC_ScrollBarAddLine and SC_ScrollBarSubLine were identical so avoid code duplication and merge them into one. Pick-to: 6.9 Change-Id: I77a1303badb500a8d8ada3355b34a42a93fb069a Reviewed-by: Volker Hilsheimer <[email protected]>
1 parent 5b6cbb9 commit 616d33c

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

src/plugins/styles/modernwindows/qwindows11style.cpp

+3-17
Original file line numberDiff line numberDiff line change
@@ -2026,27 +2026,13 @@ QRect QWindows11Style::subControlRect(ComplexControl control, const QStyleOption
20262026
{
20272027
ret = QCommonStyle::subControlRect(control, option, subControl, widget);
20282028

2029-
switch (subControl) {
2030-
case QStyle::SC_ScrollBarAddLine:
2029+
if (subControl == SC_ScrollBarAddLine || subControl == SC_ScrollBarSubLine) {
20312030
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
2032-
if (scrollbar->orientation == Qt::Vertical) {
2031+
if (scrollbar->orientation == Qt::Vertical)
20332032
ret = ret.adjusted(2,2,-2,-3);
2034-
} else {
2035-
ret = ret.adjusted(3,2,-2,-2);
2036-
}
2037-
}
2038-
break;
2039-
case QStyle::SC_ScrollBarSubLine:
2040-
if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
2041-
if (scrollbar->orientation == Qt::Vertical) {
2042-
ret = ret.adjusted(2,2,-2,-3);
2043-
} else {
2033+
else
20442034
ret = ret.adjusted(3,2,-2,-2);
2045-
}
20462035
}
2047-
break;
2048-
default:
2049-
break;
20502036
}
20512037
break;
20522038
}

0 commit comments

Comments
 (0)