diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-09 16:55:30 +0200 |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-09 17:40:13 +0200 |
commit | 9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8 (patch) | |
tree | fa7c1766f8925576606d575f923fe3d18d5c3d41 | |
parent | b81f1099d84d9be5c99905b506ab86d477cd625b (diff) | |
download | qt4-tools-9b70924fe2ff5b4bc7246c46a9e3af764bb8bbc8.tar.gz |
Update lastTick on all timerTicks in QAbstractAnimation
This is needed in case we change consistentTime while the animation is
running.
Reviewed-by: thierry
-rw-r--r-- | src/corelib/animation/qabstractanimation.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
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 { |