From 3a32bab2aa643cc92e1198f55742532908d32834 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Tue, 18 Jun 2024 20:17:22 +0200 Subject: [PATCH] Fusion style/QProgressBar: don't ignore the paint offset The progress bar drawing only works correct when the topLeft corner is at 0/0 therefore we have to translate the painter to fix the drawing in such a case. Pick-to: 6.7 Task-number: QTBUG-126426 Change-Id: I51086dab65cc0d4a360ee539e59e3f3f4af2a375 Reviewed-by: Volker Hilsheimer (cherry picked from commit 369b5a3194f69072a961283c4d5e19395e0d8b06) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qfusionstyle.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 6b8fd979a9..b8795379bd 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1220,6 +1220,8 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->save(); painter->setRenderHint(QPainter::Antialiasing, true); if (const QStyleOptionProgressBar *bar = qstyleoption_cast(option)) { + painter->translate(rect.topLeft()); + rect.translate(-rect.topLeft()); const auto indeterminate = (bar->minimum == 0 && bar->maximum == 0); const auto complete = bar->progress == bar->maximum; const auto vertical = !(bar->state & QStyle::State_Horizontal);