diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 9f58c9d51f..6b12ca9540 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -81,6 +81,12 @@ void QStyleAnimation::setStartTime(const QTime &time) _startTime = time; } +void QStyleAnimation::updateTarget() +{ + QEvent event(QEvent::StyleAnimationUpdate); + QCoreApplication::sendEvent(target(), &event); +} + bool QStyleAnimation::isUpdateNeeded() const { return true; @@ -95,10 +101,8 @@ void QStyleAnimation::updateCurrentTime(int) stop(); } - if (isUpdateNeeded()) { - QEvent event(QEvent::StyleAnimationUpdate); - QCoreApplication::sendEvent(tgt, &event); - } + if (isUpdateNeeded()) + updateTarget(); } } diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h index 8231abbb40..577b1d7dd4 100644 --- a/src/widgets/styles/qstyleanimation_p.h +++ b/src/widgets/styles/qstyleanimation_p.h @@ -72,6 +72,8 @@ public: QTime startTime() const; void setStartTime(const QTime &time); + void updateTarget(); + protected: virtual bool isUpdateNeeded() const; virtual void updateCurrentTime(int time);