/*! \reimp */ void QParallelAnimationGroup::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) { Q_D(QParallelAnimationGroup); QAnimationGroup::updateState(newState, oldState); switch (newState) { case Stopped: for (int i = 0; i < d->animations.size(); ++i) d->animations.at(i)->stop(); d->disconnectUncontrolledAnimations(); break; case Paused: for (int i = 0; i < d->animations.size(); ++i) if (d->animations.at(i)->state() == Running) d->animations.at(i)->pause(); break; case Running: d->connectUncontrolledAnimations(); for (int i = 0; i < d->animations.size(); ++i) { QAbstractAnimation *animation = d->animations.at(i); if (oldState == Stopped) animation->stop(); animation->setDirection(d->direction); if (d->shouldAnimationStart(animation, oldState == Stopped)) animation->start(); } break; } }
/*! \reimp */ void QParallelAnimationGroup::updateDirection(QAbstractAnimation::Direction direction) { Q_D(QParallelAnimationGroup); //we need to update the direction of the current animation if (state() != Stopped) { for (int i = 0; i < d->animations.size(); ++i) { QAbstractAnimation *animation = d->animations.at(i); animation->setDirection(direction); } } else { if (direction == Forward) { d->lastLoop = 0; d->lastCurrentTime = 0; } else { // Looping backwards with loopCount == -1 does not really work well... d->lastLoop = (d->loopCount == -1 ? 0 : d->loopCount - 1); d->lastCurrentTime = duration(); } } }