diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-07 14:36:55 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-10-07 15:37:48 (GMT) |
commit | df886d78631a8a7ea3aa8fdbb9da18d5a3387ed1 (patch) | |
tree | 5ee365d74f22107e8dafd30dff0ee785300c2e6f /src | |
parent | cd32bfdd74a9615d28670a197296821d7cf2844d (diff) | |
download | Qt-df886d78631a8a7ea3aa8fdbb9da18d5a3387ed1.zip Qt-df886d78631a8a7ea3aa8fdbb9da18d5a3387ed1.tar.gz Qt-df886d78631a8a7ea3aa8fdbb9da18d5a3387ed1.tar.bz2 |
In QParallelAnimationGroup, only stop the children if they arent stopped
The previous code was settingCurrentTime on all animatios, even on those
that had already finished long ago.
Reviewed-by: thierry
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/animation/qparallelanimationgroup.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 2812854..0a04c14 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -136,7 +136,9 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) int dura = duration(); if (dura > 0) { for (int i = 0; i < d->animations.size(); ++i) { - d->animations.at(i)->setCurrentTime(dura); // will stop + QAbstractAnimation *animation = d->animations.at(i); + if (animation->state() != QAbstractAnimation::Stopped) + d->animations.at(i)->setCurrentTime(dura); // will stop } } } else if (d->currentLoop < d->lastLoop) { @@ -160,7 +162,7 @@ void QParallelAnimationGroup::updateCurrentTime(int currentTime) QAbstractAnimation *animation = d->animations.at(i); const int dura = animation->totalDuration(); //if the loopcount is bigger we should always start all animations - if (d->currentLoop > d->lastLoop + if (d->currentLoop > d->lastLoop //if we're at the end of the animation, we need to start it if it wasn't already started in this loop //this happens in Backward direction where not all animations are started at the same time || d->shouldAnimationStart(animation, d->lastCurrentTime > dura /*startIfAtEnd*/)) { @@ -283,7 +285,7 @@ bool QParallelAnimationGroupPrivate::shouldAnimationStart(QAbstractAnimation *an void QParallelAnimationGroupPrivate::applyGroupState(QAbstractAnimation *animation) { - switch (state) + switch (state) { case QAbstractAnimation::Running: animation->start(); |