src/corelib/animation/qabstractanimation.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
--- a/src/corelib/animation/qabstractanimation.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/corelib/animation/qabstractanimation.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -168,7 +168,7 @@
 QUnifiedTimer::QUnifiedTimer() :
     QObject(), lastTick(0), timingInterval(DEFAULT_TIMER_INTERVAL),
     currentAnimationIdx(0), consistentTiming(false), slowMode(false),
-    isPauseTimerActive(false), runningLeafAnimations(0)
+    slowdownFactor(5.0f), isPauseTimerActive(false), runningLeafAnimations(0)
 {
     time.invalidate();
 }
@@ -205,12 +205,18 @@
 
 void QUnifiedTimer::updateAnimationsTime()
 {
+    qint64 totalElapsed = time.elapsed();
     // ignore consistentTiming in case the pause timer is active
     int delta = (consistentTiming && !isPauseTimerActive) ?
-                        timingInterval : time.elapsed() - lastTick;
-    if (slowMode)
-        delta /= 5;
-    lastTick = time.elapsed();
+                        timingInterval : totalElapsed - lastTick;
+    if (slowMode) {
+        if (slowdownFactor > 0)
+            delta = qRound(delta / slowdownFactor);
+        else
+            delta = 0;
+    }
+
+    lastTick = totalElapsed;
 
     //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