diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 95e52b41ef5..1b0e18d8b93 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1300,14 +1300,21 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio painter->setPen(QPen(highlightedGradientStartColor, 9.0)); painter->setClipRect(progressBar.adjusted(1, 1, -1, -1)); #if QT_CONFIG(animation) - if (QProgressStyleAnimation *animation = qobject_cast(d->animation(option->styleObject))) - step = animation->animationStep() % 22; - else - (const_cast(d))->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); + if (QProgressStyleAnimation *animation = + qobject_cast(d->animation(option->styleObject))) { + step = animation->animationStep() % 22; + } else { + (const_cast(d))->startAnimation( + new QProgressStyleAnimation(d->animationFps, option->styleObject) + ); + } #endif - for (int x = progressBar.left() - rect.height(); x < rect.right() ; x += 22) - painter->drawLine(x + step, progressBar.bottom() + 1, - x + rect.height() + step, progressBar.top() - 2); + QVarLengthArray lines; + for (int x = progressBar.left() - rect.height(); x < rect.right() ; x += 22) { + lines.emplace_back(x + step, progressBar.bottom() + 1, + x + rect.height() + step, progressBar.top() - 2); + } + painter->drawLines(lines.data(), lines.count()); } } if (!indeterminate && !complete) {