diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-09-20 15:26:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-26 17:32:40 +0200 |
commit | 57ae961bcf09efd98968b918332f8ff30562cd92 (patch) | |
tree | 84692bed8063ba3f520d0117ed11345d6eeb8dc9 /src/qml/animations/qparallelanimationgroupjob.cpp | |
parent | 6d425ebab34030ff12572f9588eac589930f2659 (diff) |
Support looping for "uncontrolled animations".
The render thread animations rely heavily on uncontrolled
animations, meaning animations with duration=-1. We support
this by adding a m_currentLoopStartTime and incrementally
counting the finish time of each uncontrolled animation.
Change-Id: I1f2ccea09aff4c51b1a7f98a2ddb58636af50557
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/qml/animations/qparallelanimationgroupjob.cpp')
-rw-r--r-- | src/qml/animations/qparallelanimationgroupjob.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/qml/animations/qparallelanimationgroupjob.cpp b/src/qml/animations/qparallelanimationgroupjob.cpp index c49bb873b5..43dda478f7 100644 --- a/src/qml/animations/qparallelanimationgroupjob.cpp +++ b/src/qml/animations/qparallelanimationgroupjob.cpp @@ -216,11 +216,20 @@ void QParallelAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimatio return; int maxDuration = 0; - for (QAbstractAnimationJob *job = firstChild(); job; job = job->nextSibling()) + bool running = false; + for (QAbstractAnimationJob *job = firstChild(); job; job = job->nextSibling()) { + if (job->state() == Running) + running = true; maxDuration = qMax(maxDuration, job->totalDuration()); + } + + setUncontrolledAnimationFinishTime(this, qMax(maxDuration, currentTime())); - if (m_currentTime >= maxDuration) + if (!running + && ((m_direction == Forward && m_currentLoop == m_loopCount -1) + || m_direction == Backward && m_currentLoop == 0)) { stop(); + } } QT_END_NAMESPACE |