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 <volker.hilsheimer@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 314a5b972646a4f2ef9c1f49ddfd335f546336ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit bf535c4c66b8d39e7c9a067155bdf2f6ea26a924)
This commit is contained in:
Christian Ehrlicher 2024-12-27 10:19:55 +01:00 committed by Qt Cherry-pick Bot
parent 70c663a925
commit a349c0fd2b

View File

@ -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;