From a349c0fd2bcb21f79062df077c77ea3ed2b65d8a Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 27 Dec 2024 10:19:55 +0100 Subject: [PATCH] Windows11 style: fix drawing horizontal progressbar in rtl mode The progressbar content calculation assumes that subElementRect(SE_ProgressBarContents) returns a rect at 0/0 which is not the case for progressbars in rtl mode. Fix it by moving the topLeft edge to 0/0 and translating the painter accordingly Task-number: QTBUG-132459 Change-Id: I614589c9094b0da3c02867b45570d4dfdca61a18 Reviewed-by: Volker Hilsheimer Reviewed-by: Oliver Wolff (cherry picked from commit 314a5b972646a4f2ef9c1f49ddfd335f546336ab) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit bf535c4c66b8d39e7c9a067155bdf2f6ea26a924) --- src/plugins/styles/modernwindows/qwindows11style.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index bab51a35db9..a5719755747 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -1274,6 +1274,8 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op const qreal progressBarThickness = 3; const qreal progressBarHalfThickness = progressBarThickness / 2.0; QRectF rect = subElementRect(SE_ProgressBarContents, progbaropt, widget); + painter->translate(rect.topLeft()); + rect.moveTo(QPoint(0, 0)); QRectF originalRect = rect; QPointF center = rect.center(); bool isIndeterminate = progbaropt->maximum == 0 && progbaropt->minimum == 0;