summaryrefslogtreecommitdiffstats
path: root/src/corelib/animation/qabstractanimation.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-10-23 10:05:30 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-10-23 10:05:30 (GMT)
commite751b8e9b0fdc1e23084a102ca6d86fea7f530d4 (patch)
tree45ea1097f9c2c42e53900bb91e0b7709541c7c1f /src/corelib/animation/qabstractanimation.cpp
parentcc4d3fbc317bc9044c3ce23569f0225b29af4fd5 (diff)
downloadQt-e751b8e9b0fdc1e23084a102ca6d86fea7f530d4.zip
Qt-e751b8e9b0fdc1e23084a102ca6d86fea7f530d4.tar.gz
Qt-e751b8e9b0fdc1e23084a102ca6d86fea7f530d4.tar.bz2
MAke sure we call setCurrentTime when an animation is started
This could be prevented by a pause animation currently running. Reviewed-by: Leo
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index f83c2a1..b8b9214 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -194,15 +194,10 @@ QUnifiedTimer *QUnifiedTimer::instance()
return inst;
}
-void QUnifiedTimer::ensureTimerUpdate(QAbstractAnimation *animation)
+void QUnifiedTimer::ensureTimerUpdate()
{
- if (isPauseTimerActive) {
+ if (isPauseTimerActive)
updateAnimationsTime();
- } else {
- // this code is needed when ensureTimerUpdate is called from setState because we update
- // the currentTime when an animation starts running (otherwise we could remove it)
- animation->setCurrentTime(animation->currentTime());
- }
}
void QUnifiedTimer::updateAnimationsTime()
@@ -381,7 +376,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
case QAbstractAnimation::Paused:
if (hasRegisteredTimer)
// currentTime needs to be updated if pauseTimer is active
- QUnifiedTimer::instance()->ensureTimerUpdate(q);
+ QUnifiedTimer::instance()->ensureTimerUpdate();
if (!guard)
return;
//here we're sure that we were in running state before and that the
@@ -395,9 +390,11 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
// this ensures that the value is updated now that the animation is running
if (oldState == QAbstractAnimation::Stopped) {
- if (isTopLevel)
+ if (isTopLevel) {
// currentTime needs to be updated if pauseTimer is active
- QUnifiedTimer::instance()->ensureTimerUpdate(q);
+ QUnifiedTimer::instance()->ensureTimerUpdate();
+ q->setCurrentTime(totalCurrentTime);
+ }
}
}
break;
@@ -558,7 +555,7 @@ void QAbstractAnimation::setDirection(Direction direction)
// the commands order below is important: first we need to setCurrentTime with the old direction,
// then update the direction on this and all children and finally restart the pauseTimer if needed
if (d->hasRegisteredTimer)
- QUnifiedTimer::instance()->ensureTimerUpdate(this);
+ QUnifiedTimer::instance()->ensureTimerUpdate();
d->direction = direction;
updateDirection(direction);