From a98b9435579f5abef82036e81af4488d8a464b66 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 16 Oct 2012 16:35:34 +0200 Subject: Styles: revise indeterminate progress bar animations Remove dependencies to QProgressBar where possible. This makes it possible to animate for example QQuickItem based progress bars (read: the desktop components). Change-Id: If208506702365895576238c24191b8d70b90841c Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qstyleanimation.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/widgets/styles/qstyleanimation.cpp') diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 8bc8e9d241..297a929970 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -47,8 +47,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_ANIMATION - QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(target), _startTime(QTime::currentTime()) { @@ -128,21 +126,13 @@ void QProgressStyleAnimation::setSpeed(int speed) bool QProgressStyleAnimation::isUpdateNeeded() const { - QProgressBar *pb = qobject_cast(parent()); - if (pb && pb->minimum() == 0 && pb->maximum() == 0) { - int current = animationStep(); - if (_step == -1 || _step != current) - { - _step = current; - return true; - } - } else { - // the progress bar is no longer indeterminate -> stop - const_cast(this)->stop(); + int current = animationStep(); + if (_step == -1 || _step != current) + { + _step = current; + return true; } return false; } -#endif // QT_NO_ANIMATION - QT_END_NAMESPACE -- cgit v1.2.3