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 <volker.hilsheimer@qt.io>
(cherry picked from commit 369b5a3194f69072a961283c4d5e19395e0d8b06)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
Christian Ehrlicher 2024-06-18 20:17:22 +02:00 committed by Qt Cherry-pick Bot
parent d69c8fd98a
commit 3a32bab2aa
1 changed files with 2 additions and 0 deletions

View File

@ -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<const QStyleOptionProgressBar *>(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);