From 3dbc4ad00f809b110f143f2473c230bc5c481391 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 2 Oct 2009 17:13:11 +0200 Subject: In QAbstractAnimation::setState setCurrentTime when animation pauses If we want to avoid timer ticks in QPauseAnimation, We need to update the current time when an animation pauses, for being able to resume correctly. Reviewed-by: thierry --- src/corelib/animation/qabstractanimation.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 2769040..a4a8853 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -292,22 +292,23 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) switch (state) { case QAbstractAnimation::Paused: + q->setCurrentTime(currentTime); + if (!guard) + return; + QUnifiedTimer::instance()->unregisterAnimation(q); + break; case QAbstractAnimation::Running: - //this ensures that the value is updated now that the animation is running - if(oldState == QAbstractAnimation::Stopped) { + // this ensures that the value is updated now that the animation is running + if (oldState == QAbstractAnimation::Stopped) { q->setCurrentTime(currentTime); if (!guard) return; } - // Register timer if our parent is not running. if (state == QAbstractAnimation::Running) { - if (!group || group->state() == QAbstractAnimation::Stopped) { + // Register timer if our parent is not running + if (!group || group->state() == QAbstractAnimation::Stopped) QUnifiedTimer::instance()->registerAnimation(q); - } - } else { - //new state is paused - QUnifiedTimer::instance()->unregisterAnimation(q); } break; case QAbstractAnimation::Stopped: -- cgit v0.12