From c876e78719737e3fb7c94c77665bb4653c4a842b 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. Change-Id: I517fcea19837a6438edc261e066930218b71ce28 Reviewed-by: Volker Hilsheimer (cherry picked from commit 02920ef05a980d9bb670e1f8a4b84e0b6cef13c1) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 72f48d084095f0fa103bfa6ea70c1b74e4a165be) --- 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 cb2d6b5a59a..7eefd175448 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -477,6 +477,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; @@ -517,7 +518,8 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt f.setPointSize(6); painter->setFont(f); painter->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")); painter->drawText(rect, str, Qt::AlignVCenter | Qt::AlignHCenter); } } @@ -528,7 +530,8 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt f.setPointSize(6); painter->setFont(f); painter->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")); painter->drawText(rect, str, Qt::AlignVCenter | Qt::AlignHCenter); } }