From 616d33c87ab6dd77809ee56e39e08eed30089130 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 7 Apr 2025 20:25:42 +0200 Subject: [PATCH] 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 --- .../styles/modernwindows/qwindows11style.cpp | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index f84a2e06fdb..6ca4291feeb 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -2026,27 +2026,13 @@ QRect QWindows11Style::subControlRect(ComplexControl control, const QStyleOption { ret = QCommonStyle::subControlRect(control, option, subControl, widget); - switch (subControl) { - case QStyle::SC_ScrollBarAddLine: + if (subControl == SC_ScrollBarAddLine || subControl == SC_ScrollBarSubLine) { if (const QStyleOptionSlider *scrollbar = qstyleoption_cast(option)) { - if (scrollbar->orientation == Qt::Vertical) { + if (scrollbar->orientation == Qt::Vertical) ret = ret.adjusted(2,2,-2,-3); - } else { + else ret = ret.adjusted(3,2,-2,-2); - } } - break; - case QStyle::SC_ScrollBarSubLine: - if (const QStyleOptionSlider *scrollbar = qstyleoption_cast(option)) { - if (scrollbar->orientation == Qt::Vertical) { - ret = ret.adjusted(2,2,-2,-3); - } else { - ret = ret.adjusted(3,2,-2,-2); - } - } - break; - default: - break; } break; }