From 2d8cde43e8ead44fb8bae7078741ca2fe6266733 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 22 Apr 2014 15:38:15 +0200 Subject: [PATCH] Fix sequential animations with uncontrolled looped children. An animation needs to be through all its loop cycles or explicitly stopped before we can consider it finished. Task-number: QTBUG-37246 Change-Id: Ia30b27448ec7a1e0d2dd8165575b8a7105caae8d Reviewed-by: Michael Brasser --- src/qml/animations/qsequentialanimationgroupjob.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index 135760b..cfc53d5 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -75,8 +75,12 @@ bool QSequentialAnimationGroupJob::atEnd() const int QSequentialAnimationGroupJob::animationActualTotalDuration(QAbstractAnimationJob *anim) const { int ret = anim->totalDuration(); - if (ret == -1) - ret = uncontrolledAnimationFinishTime(anim); //we can try the actual duration there + if (ret == -1) { + int done = uncontrolledAnimationFinishTime(anim); + // If the animation has reached the end, use the uncontrolledFinished value. + if (done >= 0 && (anim->loopCount() - 1 == anim->currentLoop() || anim->state() == Stopped)) + return done; + } return ret; } -- 2.7.4