From 9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8 Mon Sep 17 00:00:00 2001 From: Leonardo Sobral Cunha Date: Fri, 9 Oct 2009 16:55:30 +0200 Subject: Update lastTick on all timerTicks in QAbstractAnimation This is needed in case we change consistentTime while the animation is running. Reviewed-by: thierry --- src/corelib/animation/qabstractanimation.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/corelib/animation') diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 9e50784145..c775a00a6d 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -207,14 +207,10 @@ void QUnifiedTimer::ensureTimerUpdate(QAbstractAnimation *animation) void QUnifiedTimer::updateAnimationsTime() { - // this is simply the time we last received a tick - const int oldLastTick = lastTick; // ignore consistentTiming in case the pause timer is active - if (consistentTiming && !isPauseTimerActive) - lastTick = oldLastTick + timingInterval; - else - lastTick = time.elapsed(); - const int delta = lastTick - oldLastTick; + const int delta = (consistentTiming && !isPauseTimerActive) ? + timingInterval : time.elapsed() - lastTick; + lastTick = time.elapsed(); //we make sure we only call update time if the time has actually changed //it might happen in some cases that the time doesn't change because events are delayed @@ -293,6 +289,7 @@ void QUnifiedTimer::unregisterAnimation(QAbstractAnimation *animation) // this is needed if we unregister an animation while its running if (idx <= currentAnimationIdx) --currentAnimationIdx; + if (animations.isEmpty()) startStopAnimationTimer.start(STARTSTOP_TIMER_DELAY, this); } else { -- cgit v1.2.1