From 72f48d084095f0fa103bfa6ea70c1b74e4a165be Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 16 Dec 2024 18:04:47 +0100 Subject: [PATCH] Windows11Style: Fix horizontal scrollbar arrows in rtl mode The arrows for horizontal scrollbars must be swapped in rtl mode. Pick-to: 6.8 Change-Id: I517fcea19837a6438edc261e066930218b71ce28 Reviewed-by: Volker Hilsheimer (cherry picked from commit 02920ef05a980d9bb670e1f8a4b84e0b6cef13c1) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/styles/modernwindows/qwindows11style.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 5a90c3e4735..4c262be3980 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -487,6 +487,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt const bool vertical = scrollbar->orientation == Qt::Vertical; const bool horizontal = scrollbar->orientation == Qt::Horizontal; const bool isMouseOver = state & State_MouseOver; + const bool isRtl = option->direction == Qt::RightToLeft; if (isMouseOver) { QRectF rect = scrollbar->rect; @@ -526,7 +527,8 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt f.setPointSize(6); cp->setFont(f); cp->setPen(Qt::gray); - const auto str = vertical ? QStringLiteral(u"\uEDDC") : QStringLiteral(u"\uEDDA"); + const auto str = vertical ? QStringLiteral(u"\uEDDC") + : (isRtl ? QStringLiteral(u"\uEDD9") : QStringLiteral(u"\uEDDA")); cp->drawText(rect, str, Qt::AlignVCenter | Qt::AlignHCenter); } } @@ -537,7 +539,8 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt f.setPointSize(6); cp->setFont(f); cp->setPen(Qt::gray); - const auto str = vertical ? QStringLiteral(u"\uEDDB") : QStringLiteral(u"\uEDD9"); + const auto str = vertical ? QStringLiteral(u"\uEDDB") + : (isRtl ? QStringLiteral(u"\uEDDA") : QStringLiteral(u"\uEDD9")); cp->drawText(rect, str, Qt::AlignVCenter | Qt::AlignHCenter); } }