diff options
16 files changed, 175 insertions, 176 deletions
diff --git a/examples/animation/easing/window.cpp b/examples/animation/easing/window.cpp index c6ea360..bb45770 100644 --- a/examples/animation/easing/window.cpp +++ b/examples/animation/easing/window.cpp @@ -88,7 +88,7 @@ void Window::startAnimation() m_anim->setStartValue(QPointF(0, 0)); m_anim->setEndValue(QPointF(100, 100)); m_anim->setDuration(2000); - m_anim->setIterationCount(-1); // forever + m_anim->setLoopCount(-1); // forever m_anim->start(); } diff --git a/examples/animation/research/memberfunctions/qvalueanimation.cpp b/examples/animation/research/memberfunctions/qvalueanimation.cpp index 2fe9be9..58652ba 100644 --- a/examples/animation/research/memberfunctions/qvalueanimation.cpp +++ b/examples/animation/research/memberfunctions/qvalueanimation.cpp @@ -21,8 +21,8 @@ void QValueAnimationPrivate::initDefaultStartValue() { Q_Q(QValueAnimation); if (animProp && !q->startValue().isValid() - && ((currentTime == 0 && (currentIteration || currentIteration == 0)) - || (currentTime == duration && currentIteration == (iterationCount - 1)))) { + && (currentTime == 0 + || (currentTime == duration && currentLoop == (loopCount - 1)))) { setDefaultStartValue(animProp->read()); } } diff --git a/examples/animation/sub-attaq/custompropertyanimation.cpp b/examples/animation/sub-attaq/custompropertyanimation.cpp index 45997af..1637ed2 100644 --- a/examples/animation/sub-attaq/custompropertyanimation.cpp +++ b/examples/animation/sub-attaq/custompropertyanimation.cpp @@ -55,9 +55,8 @@ void CustomPropertyAnimationPrivate::initDefaultStartValue() QVariant def = animProp->read(); if (def.isValid()) convertValues(def.userType()); - if (animProp && !defaultStartValue.isValid() - && ((currentTime == 0 && (currentIteration || currentIteration == 0)) - || (currentTime == duration && currentIteration == (iterationCount - 1)))) { + if (animProp && !defaultStartValue.isValid() && currentTime == 0 + || (currentTime == duration && currentLoop == (loopCount - 1))) { setDefaultStartValue(def); } } diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 2b9e77d..71ef45c 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -55,15 +55,15 @@ QVariantAnimation and QAnimationGroup, instead. QAbstractAnimation provides an interface for the current time and - duration, the iteration count, and the state of an animation. These properties + duration, the loop count, and the state of an animation. These properties define the base functionality common to all animations in Qt. The virtual duration() function returns the local duration of the animation; i.e., for how long the animation should update the current time before looping. Subclasses can implement this function differently; for example, QVariantAnimation returns the duration of a simple animated property, whereas QAnimationGroup returns the duration of a set or sequence of - animations. You can also set a loop count by calling setIterationCount(); a - iteration count of 2 will let the animation run twice (the default value is + animations. You can also set a loop count by calling setLoopCount(); a + loop count of 2 will let the animation run twice (the default value is 1). Like QTimeLine, QAbstractAnimation also provides an interface for starting @@ -119,12 +119,12 @@ */ /*! - \fn QAbstractAnimation::currentIterationChanged(int currentIteration) + \fn QAbstractAnimation::currentLoopChanged(int currentLoop) - QAbstractAnimation emits this signal whenever the current iteration - changes. \a currentIteration is the current iteration. + QAbstractAnimation emits this signal whenever the current loop + changes. \a currentLoop is the current loop. - \sa currentIteration(), iterationCount() + \sa currentLoop(), loopCount() */ /*! @@ -245,7 +245,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) QAbstractAnimation::State oldState = state; int oldCurrentTime = currentTime; - int oldCurrentIteration = currentIteration; + int oldCurrentLoop = currentLoop; QAbstractAnimation::Direction oldDirection = direction; state = newState; @@ -274,7 +274,7 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) if (direction == QAbstractAnimation::Forward) q->setCurrentTime(0); else - q->setCurrentTime(iterationCount == -1 ? q->duration() : q->totalDuration()); + q->setCurrentTime(loopCount == -1 ? q->duration() : q->totalDuration()); } // Check if the setCurrentTime() function called stop(). @@ -302,8 +302,8 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState) QUnifiedTimer::instance()->unregisterAnimation(q); - if (dura == -1 || iterationCount < 0 - || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentIteration + 1)) == (dura * iterationCount)) + if (dura == -1 || loopCount < 0 + || (oldDirection == QAbstractAnimation::Forward && (oldCurrentTime * (oldCurrentLoop + 1)) == (dura * loopCount)) || (oldDirection == QAbstractAnimation::Backward && oldCurrentTime == 0)) { if (guard) emit q->finished(); @@ -459,10 +459,10 @@ void QAbstractAnimation::setDirection(Direction direction) if (state() == Stopped) { if (direction == Backward) { d->currentTime = duration(); - d->currentIteration = d->iterationCount - 1; + d->currentLoop = d->loopCount - 1; } else { d->currentTime = 0; - d->currentIteration = 0; + d->currentLoop = 0; } } updateDirection(direction); @@ -474,14 +474,14 @@ void QAbstractAnimation::setDirection(Direction direction) \brief the duration of the animation. If the duration is -1, it means that the duration is undefined. - In this case, iterationCount is ignored. + In this case, loopCount is ignored. */ /*! - \property QAbstractAnimation::iterationCount - \brief the iteration count of the animation + \property QAbstractAnimation::loopCount + \brief the loop count of the animation - This property describes the iteration count of the animation as an integer. + This property describes the loop count of the animation as an integer. By default this value is 1, indicating that the animation should run once only, and then stop. By changing it you can let the animation loop several times. With a value of 0, the animation will not @@ -490,34 +490,34 @@ void QAbstractAnimation::setDirection(Direction direction) It is not supported to have loop on an animation that has an undefined duration. It will only run once. */ -int QAbstractAnimation::iterationCount() const +int QAbstractAnimation::loopCount() const { Q_D(const QAbstractAnimation); - return d->iterationCount; + return d->loopCount; } -void QAbstractAnimation::setIterationCount(int iterationCount) +void QAbstractAnimation::setLoopCount(int loopCount) { Q_D(QAbstractAnimation); - d->iterationCount = iterationCount; + d->loopCount = loopCount; } /*! - \property QAbstractAnimation::currentIteration - \brief the current iteration of the animation + \property QAbstractAnimation::currentLoop + \brief the current loop of the animation - This property describes the current iteration of the animation. By default, - the animation's iteration count is 1, and so the current iteration will - always be 0. If the iteration count is 2 and the animation runs past its + This property describes the current loop of the animation. By default, + the animation's loop count is 1, and so the current loop will + always be 0. If the loop count is 2 and the animation runs past its duration, it will automatically rewind and restart at current time 0, and - current iteration 1, and so on. + current loop 1, and so on. - When the current iteration changes, QAbstractAnimation emits the - currentIterationChanged() signal. + When the current loop changes, QAbstractAnimation emits the + currentLoopChanged() signal. */ -int QAbstractAnimation::currentIteration() const +int QAbstractAnimation::currentLoop() const { Q_D(const QAbstractAnimation); - return d->currentIteration; + return d->currentLoop; } /*! @@ -525,7 +525,7 @@ int QAbstractAnimation::currentIteration() const This pure virtual function returns the duration of the animation, and defines for how long QAbstractAnimation should update the current - time. This duration is local, and does not include the iteration count. + time. This duration is local, and does not include the loop count. A return value of -1 indicates that the animation has no defined duration; the animation should run forever until stopped. This is useful for @@ -535,24 +535,24 @@ int QAbstractAnimation::currentIteration() const If the animation is a parallel QAnimationGroup, the duration will be the longest duration of all its animations. If the animation is a sequential QAnimationGroup, the duration will be the sum of the duration of all its animations. - \sa iterationCount + \sa loopCount */ /*! Returns the total and effective duration of the animation, including the - iteration count. + loop count. \sa duration(), currentTime */ int QAbstractAnimation::totalDuration() const { Q_D(const QAbstractAnimation); - if (d->iterationCount < 0) + if (d->loopCount < 0) return -1; int dura = duration(); if (dura == -1) return -1; - return dura * d->iterationCount; + return dura * d->loopCount; } /*! @@ -565,11 +565,11 @@ int QAbstractAnimation::totalDuration() const progresses. The animation's current time starts at 0, and ends at duration(). If the - animation's iterationCount is larger than 1, the current time will rewind and + animation's loopCount is larger than 1, the current time will rewind and start at 0 again for the consecutive loops. If the animation has a pause. currentTime will also include the duration of the pause. - \sa iterationCount + \sa loopCount */ int QAbstractAnimation::currentTime() const { @@ -583,31 +583,31 @@ void QAbstractAnimation::setCurrentTime(int msecs) // Calculate new time and loop. int dura = duration(); - int totalDura = (d->iterationCount < 0 || dura == -1) ? -1 : dura * d->iterationCount; + int totalDura = (d->loopCount < 0 || dura == -1) ? -1 : dura * d->loopCount; if (totalDura != -1) msecs = qMin(totalDura, msecs); d->totalCurrentTime = msecs; // Update new values. - int oldLoop = d->currentIteration; - d->currentIteration = ((dura <= 0) ? 0 : (msecs / dura)); - if (d->currentIteration == d->iterationCount) { + int oldLoop = d->currentLoop; + d->currentLoop = ((dura <= 0) ? 0 : (msecs / dura)); + if (d->currentLoop == d->loopCount) { //we're at the end d->currentTime = qMax(0, dura); - d->currentIteration = qMax(0, d->iterationCount - 1); + d->currentLoop = qMax(0, d->loopCount - 1); } else { if (d->direction == Forward) { d->currentTime = (dura <= 0) ? msecs : (msecs % dura); } else { d->currentTime = (dura <= 0) ? msecs : ((msecs - 1) % dura) + 1; if (d->currentTime == dura) - --d->currentIteration; + --d->currentLoop; } } updateCurrentTime(msecs); - if (d->currentIteration != oldLoop) - emit currentIterationChanged(d->currentIteration); + if (d->currentLoop != oldLoop) + emit currentLoopChanged(d->currentLoop); // All animations are responsible for stopping the animation when their // own end state is reached; in this case the animation is time driven, @@ -648,7 +648,7 @@ void QAbstractAnimation::start(DeletionPolicy policy) signal, and state() returns Stopped. The current time is not changed. If the animation stops by itself after reaching the end (i.e., - currentTime() == duration() and currentIteration() > iterationCount() - 1), the + currentTime() == duration() and currentLoop() > loopCount() - 1), the finished() signal is emitted. \sa start(), state() diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index d6260cd..a7f0082 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -60,9 +60,9 @@ class Q_CORE_EXPORT QAbstractAnimation : public QObject { Q_OBJECT Q_PROPERTY(State state READ state NOTIFY stateChanged) - Q_PROPERTY(int iterationCount READ iterationCount WRITE setIterationCount) + Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount) Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime) - Q_PROPERTY(int currentIteration READ currentIteration NOTIFY currentIterationChanged) + Q_PROPERTY(int currentLoop READ currentLoop NOTIFY currentLoopChanged) Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged) Q_PROPERTY(int duration READ duration) @@ -93,9 +93,9 @@ public: Direction direction() const; void setDirection(Direction direction); - int iterationCount() const; - void setIterationCount(int iterationCount); - int currentIteration() const; + int loopCount() const; + void setLoopCount(int loopCount); + int currentLoop() const; virtual int duration() const = 0; int totalDuration() const; @@ -105,7 +105,7 @@ public: Q_SIGNALS: void finished(); void stateChanged(QAbstractAnimation::State oldState, QAbstractAnimation::State newState); - void currentIterationChanged(int currentIteration); + void currentLoopChanged(int currentLoop); void directionChanged(QAbstractAnimation::Direction); public Q_SLOTS: diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index 28d7d71..666e6a7 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -77,8 +77,8 @@ public: deleteWhenStopped(false), totalCurrentTime(0), currentTime(0), - iterationCount(1), - currentIteration(0), + loopCount(1), + currentLoop(0), group(0) { } @@ -97,8 +97,8 @@ public: int totalCurrentTime; int currentTime; - int iterationCount; - int currentIteration; + int loopCount; + int currentLoop; QAnimationGroup *group; #ifdef QT_EXPERIMENTAL_SOLUTION diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp index 993c577..407ffde 100644 --- a/src/corelib/animation/qparallelanimationgroup.cpp +++ b/src/corelib/animation/qparallelanimationgroup.cpp @@ -111,7 +111,7 @@ void QParallelAnimationGroup::updateCurrentTime(int) if (d->animations.isEmpty()) return; - if (d->currentIteration > d->lastIteration) { + if (d->currentLoop > d->lastLoop) { // simulate completion of the loop int dura = duration(); if (dura > 0) { @@ -119,7 +119,7 @@ void QParallelAnimationGroup::updateCurrentTime(int) animation->setCurrentTime(dura); // will stop } } - } else if (d->currentIteration < d->lastIteration) { + } else if (d->currentLoop < d->lastLoop) { // simulate completion of the loop seeking backwards foreach (QAbstractAnimation *animation, d->animations) { animation->setCurrentTime(0); @@ -127,11 +127,11 @@ void QParallelAnimationGroup::updateCurrentTime(int) } } - bool timeFwd = ((d->currentIteration == d->lastIteration && d->currentTime >= d->lastCurrentTime) - || d->currentIteration > d->lastIteration); + bool timeFwd = ((d->currentLoop == d->lastLoop && d->currentTime >= d->lastCurrentTime) + || d->currentLoop > d->lastLoop); #ifdef QANIMATION_DEBUG qDebug("QParallellAnimationGroup %5d: setCurrentTime(%d), loop:%d, last:%d, timeFwd:%d, lastcurrent:%d, %d", - __LINE__, d->currentTime, d->currentIteration, d->lastIteration, timeFwd, d->lastCurrentTime, state()); + __LINE__, d->currentTime, d->currentLoop, d->lastLoop, timeFwd, d->lastCurrentTime, state()); #endif // finally move into the actual time of the current loop foreach (QAbstractAnimation *animation, d->animations) { @@ -139,7 +139,7 @@ void QParallelAnimationGroup::updateCurrentTime(int) if (dura == -1 && d->isUncontrolledAnimationFinished(animation)) continue; if (dura == -1 || (d->currentTime <= dura && dura != 0) - || (dura == 0 && d->currentIteration != d->lastIteration)) { + || (dura == 0 && d->currentLoop != d->lastLoop)) { switch (state()) { case Running: animation->start(); @@ -165,7 +165,7 @@ void QParallelAnimationGroup::updateCurrentTime(int) if (d->currentTime > dura) animation->stop(); } - d->lastIteration = d->currentIteration; + d->lastLoop = d->currentLoop; d->lastCurrentTime = d->currentTime; } @@ -207,7 +207,7 @@ void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished() Q_ASSERT(animation); int uncontrolledRunningCount = 0; - if (animation->duration() == -1 || animation->iterationCount() < 0) { + if (animation->duration() == -1 || animation->loopCount() < 0) { QHash<QAbstractAnimation *, int>::iterator it = uncontrolledFinishTime.begin(); while (it != uncontrolledFinishTime.end()) { if (it.key() == animation) { @@ -248,7 +248,7 @@ void QParallelAnimationGroupPrivate::connectUncontrolledAnimations() Q_Q(QParallelAnimationGroup); foreach (QAbstractAnimation *animation, animations) { - if (animation->duration() == -1 || animation->iterationCount() < 0) { + if (animation->duration() == -1 || animation->loopCount() < 0) { uncontrolledFinishTime[animation] = -1; QObject::connect(animation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished())); } @@ -273,11 +273,11 @@ void QParallelAnimationGroup::updateDirection(QAbstractAnimation::Direction dire } } else { if (direction == Forward) { - d->lastIteration = 0; + d->lastLoop = 0; d->lastCurrentTime = 0; } else { - // Looping backwards with iterationCount == -1 does not really work well... - d->lastIteration = (d->iterationCount == -1 ? 0 : d->iterationCount - 1); + // Looping backwards with loopCount == -1 does not really work well... + d->lastLoop = (d->loopCount == -1 ? 0 : d->loopCount - 1); d->lastCurrentTime = duration(); } } diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h index 8a4dc1b..f36d972 100644 --- a/src/corelib/animation/qparallelanimationgroup_p.h +++ b/src/corelib/animation/qparallelanimationgroup_p.h @@ -64,12 +64,12 @@ class QParallelAnimationGroupPrivate : public QAnimationGroupPrivate Q_DECLARE_PUBLIC(QParallelAnimationGroup) public: QParallelAnimationGroupPrivate() - : lastIteration(0), lastCurrentTime(0) + : lastLoop(0), lastCurrentTime(0) { } QHash<QAbstractAnimation*, int> uncontrolledFinishTime; - int lastIteration; + int lastLoop; int lastCurrentTime; bool isUncontrolledAnimationFinished(QAbstractAnimation *anim) const; diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp index 879532c..61ff98d 100644 --- a/src/corelib/animation/qsequentialanimationgroup.cpp +++ b/src/corelib/animation/qsequentialanimationgroup.cpp @@ -77,7 +77,7 @@ bool QSequentialAnimationGroupPrivate::atEnd() const // 3. the current animation is the last one // 4. the current animation has reached its end const int animTotalCurrentTime = QAbstractAnimationPrivate::get(currentAnimation)->totalCurrentTime; - return (currentIteration == iterationCount - 1 + return (currentLoop == loopCount - 1 && direction == QAbstractAnimation::Forward && currentAnimation == animations.last() && animTotalCurrentTime == animationActualTotalDuration(currentAnimationIndex)); @@ -101,7 +101,7 @@ QSequentialAnimationGroupPrivate::AnimationIndex QSequentialAnimationGroupPrivat int duration = 0; // in case duration is -1, currentLoop will always be 0 - ret.timeOffset = currentIteration * q->duration(); + ret.timeOffset = currentLoop * q->duration(); for (int i = 0; i < animations.size(); ++i) { duration = animationActualTotalDuration(i); @@ -133,13 +133,13 @@ void QSequentialAnimationGroupPrivate::restart() { // restarting the group by making the first/last animation the current one if (direction == QAbstractAnimation::Forward) { - lastIteration = 0; + lastLoop = 0; if (currentAnimationIndex == 0) activateCurrentAnimation(); else setCurrentAnimation(0); } else { // direction == QAbstractAnimation::Backward - lastIteration = iterationCount - 1; + lastLoop = loopCount - 1; int index = animations.size() - 1; if (currentAnimationIndex == index) activateCurrentAnimation(); @@ -156,7 +156,7 @@ void QSequentialAnimationGroupPrivate::restart() */ void QSequentialAnimationGroupPrivate::advanceForwards(const AnimationIndex &newAnimationIndex) { - if (lastIteration < currentIteration) { + if (lastLoop < currentLoop) { // we need to fast forward to the end for (int i = currentAnimationIndex; i < animations.size(); ++i) { QAbstractAnimation *anim = animations.at(i); @@ -188,7 +188,7 @@ void QSequentialAnimationGroupPrivate::advanceForwards(const AnimationIndex &new */ void QSequentialAnimationGroupPrivate::rewindForwards(const AnimationIndex &newAnimationIndex) { - if (lastIteration > currentIteration) { + if (lastLoop > currentLoop) { // we need to fast rewind to the beginning for (int i = currentAnimationIndex; i >= 0 ; --i) { QAbstractAnimation *anim = animations.at(i); @@ -329,12 +329,12 @@ void QSequentialAnimationGroup::updateCurrentTime(int msecs) d->actualDuration.removeLast(); // newAnimationIndex.index is the new current animation - if (d->lastIteration < d->currentIteration - || (d->lastIteration == d->currentIteration && d->currentAnimationIndex < newAnimationIndex.index)) { + if (d->lastLoop < d->currentLoop + || (d->lastLoop == d->currentLoop && d->currentAnimationIndex < newAnimationIndex.index)) { // advancing with forward direction is the same as rewinding with backwards direction d->advanceForwards(newAnimationIndex); - } else if (d->lastIteration > d->currentIteration - || (d->lastIteration == d->currentIteration && d->currentAnimationIndex > newAnimationIndex.index)) { + } else if (d->lastLoop > d->currentLoop + || (d->lastLoop == d->currentLoop && d->currentAnimationIndex > newAnimationIndex.index)) { // rewinding with forward direction is the same as advancing with backwards direction d->rewindForwards(newAnimationIndex); } @@ -358,7 +358,7 @@ void QSequentialAnimationGroup::updateCurrentTime(int msecs) stop(); } - d->lastIteration = d->currentIteration; + d->lastLoop = d->currentLoop; } /*! @@ -505,7 +505,7 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) setCurrentAnimation(0); // initialize the current animation if (currentAnimationIndex == index - && currentAnimation->currentTime() == 0 && currentAnimation->currentIteration() == 0) { + && currentAnimation->currentTime() == 0 && currentAnimation->currentLoop() == 0) { //in this case we simply insert an animation before the current one has actually started setCurrentAnimation(index); } @@ -513,7 +513,7 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index) //we update currentAnimationIndex in case it has changed (the animation pointer is still valid) currentAnimationIndex = animations.indexOf(currentAnimation); - if (index < currentAnimationIndex || currentIteration != 0) { + if (index < currentAnimationIndex || currentLoop != 0) { qWarning("QSequentialGroup::insertAnimationAt only supports to add animations after the current one."); return; //we're not affected because it is added after the current one } @@ -562,7 +562,7 @@ void QSequentialAnimationGroupPrivate::animationRemovedAt(int index) } //let's also update the total current time - totalCurrentTime = currentTime + iterationCount * q->duration(); + totalCurrentTime = currentTime + loopCount * q->duration(); } QT_END_NAMESPACE diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h index 05d2a40..3ac90f8 100644 --- a/src/corelib/animation/qsequentialanimationgroup_p.h +++ b/src/corelib/animation/qsequentialanimationgroup_p.h @@ -64,7 +64,7 @@ class QSequentialAnimationGroupPrivate : public QAnimationGroupPrivate Q_DECLARE_PUBLIC(QSequentialAnimationGroup) public: QSequentialAnimationGroupPrivate() - : currentAnimation(0), currentAnimationIndex(-1), lastIteration(0) + : currentAnimation(0), currentAnimationIndex(-1), lastLoop(0) { } @@ -96,7 +96,7 @@ public: QList<int> actualDuration; void restart(); - int lastIteration; + int lastLoop; // handle time changes void rewindForwards(const AnimationIndex &newAnimationIndex); diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp index 6b162ae..52e2901 100644 --- a/src/corelib/animation/qvariantanimation.cpp +++ b/src/corelib/animation/qvariantanimation.cpp @@ -279,7 +279,7 @@ QVariantAnimation::~QVariantAnimation() of the interpolated property. The easing curve is used with the interpolator, the interpolated() virtual - function, the animation's duration, and iterationCount, to control how the + function, the animation's duration, and loopCount, to control how the current value changes as the animation progresses. */ QEasingCurve QVariantAnimation::easingCurve() const diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index e468ac9..c51b471 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -97,7 +97,7 @@ public: bool atEnd() const { - return currentTime == duration && currentIteration == (iterationCount - 1); + return currentTime == duration && currentLoop == (loopCount - 1); } void setDefaultStartValue(const QVariant &value); diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp index ff5c3b4..a7d616a 100644 --- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp +++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp @@ -207,7 +207,7 @@ void tst_QAnimationGroup::setCurrentTime() QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); - a2_s_o1->setIterationCount(3); + a2_s_o1->setLoopCount(3); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); sequence->addAnimation(a3_s_o1); @@ -224,7 +224,7 @@ void tst_QAnimationGroup::setCurrentTime() QVariantAnimation *a1_p_o1 = new QPropertyAnimation(&p_o1, "value"); QVariantAnimation *a1_p_o2 = new QPropertyAnimation(&p_o2, "value"); QVariantAnimation *a1_p_o3 = new QPropertyAnimation(&p_o3, "value"); - a1_p_o2->setIterationCount(3); + a1_p_o2->setLoopCount(3); parallel->addAnimation(a1_p_o1); parallel->addAnimation(a1_p_o2); parallel->addAnimation(a1_p_o3); @@ -233,7 +233,7 @@ void tst_QAnimationGroup::setCurrentTime() QCOMPARE(notTimeDriven->totalDuration(), -1); QVariantAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value"); - loopsForever->setIterationCount(-1); + loopsForever->setLoopCount(-1); QCOMPARE(loopsForever->totalDuration(), -1); QParallelAnimationGroup group; @@ -281,11 +281,11 @@ void tst_QAnimationGroup::setCurrentTime() QCOMPARE(a1_s_o3->currentTime(), 0); QCOMPARE(a1_p_o1->currentTime(), 250); QCOMPARE(a1_p_o2->currentTime(), 0); - QCOMPARE(a1_p_o2->currentIteration(), 1); + QCOMPARE(a1_p_o2->currentLoop(), 1); QCOMPARE(a1_p_o3->currentTime(), 250); QCOMPARE(notTimeDriven->currentTime(), 250); QCOMPARE(loopsForever->currentTime(), 0); - QCOMPARE(loopsForever->currentIteration(), 1); + QCOMPARE(loopsForever->currentLoop(), 1); QCOMPARE(sequence->currentAnimation(), a2_s_o1); // Current time = 251 @@ -294,14 +294,14 @@ void tst_QAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 251); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 1); - QCOMPARE(a2_s_o1->currentIteration(), 0); + QCOMPARE(a2_s_o1->currentLoop(), 0); QCOMPARE(a3_s_o1->currentTime(), 0); QCOMPARE(sequence2->currentTime(), 251); QCOMPARE(a1_s_o2->currentTime(), 250); QCOMPARE(a1_s_o3->currentTime(), 1); QCOMPARE(a1_p_o1->currentTime(), 250); QCOMPARE(a1_p_o2->currentTime(), 1); - QCOMPARE(a1_p_o2->currentIteration(), 1); + QCOMPARE(a1_p_o2->currentLoop(), 1); QCOMPARE(a1_p_o3->currentTime(), 250); QCOMPARE(notTimeDriven->currentTime(), 251); QCOMPARE(loopsForever->currentTime(), 1); diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index c7f33b7..f2ab57a 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -71,8 +71,8 @@ private slots: void startGroupWithRunningChild(); void zeroDurationAnimation(); void stopUncontrolledAnimations(); - void iterationCount_data(); - void iterationCount(); + void loopCount_data(); + void loopCount(); void autoAdd(); }; @@ -194,7 +194,7 @@ void tst_QParallelAnimationGroup::setCurrentTime() QVariantAnimation *a1_p_o1 = new QPropertyAnimation(&p_o1, "value"); QVariantAnimation *a1_p_o2 = new QPropertyAnimation(&p_o2, "value"); QVariantAnimation *a1_p_o3 = new QPropertyAnimation(&p_o3, "value"); - a1_p_o2->setIterationCount(3); + a1_p_o2->setLoopCount(3); parallel->addAnimation(a1_p_o1); parallel->addAnimation(a1_p_o2); parallel->addAnimation(a1_p_o3); @@ -203,7 +203,7 @@ void tst_QParallelAnimationGroup::setCurrentTime() QCOMPARE(notTimeDriven->totalDuration(), -1); QVariantAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value"); - loopsForever->setIterationCount(-1); + loopsForever->setLoopCount(-1); QCOMPARE(loopsForever->totalDuration(), -1); QParallelAnimationGroup group; @@ -233,18 +233,18 @@ void tst_QParallelAnimationGroup::setCurrentTime() QCOMPARE(group.currentTime(), 250); QCOMPARE(a1_p_o1->currentTime(), 250); QCOMPARE(a1_p_o2->currentTime(), 0); - QCOMPARE(a1_p_o2->currentIteration(), 1); + QCOMPARE(a1_p_o2->currentLoop(), 1); QCOMPARE(a1_p_o3->currentTime(), 250); QCOMPARE(notTimeDriven->currentTime(), 250); QCOMPARE(loopsForever->currentTime(), 0); - QCOMPARE(loopsForever->currentIteration(), 1); + QCOMPARE(loopsForever->currentLoop(), 1); // Current time = 251 group.setCurrentTime(251); QCOMPARE(group.currentTime(), 251); QCOMPARE(a1_p_o1->currentTime(), 250); QCOMPARE(a1_p_o2->currentTime(), 1); - QCOMPARE(a1_p_o2->currentIteration(), 1); + QCOMPARE(a1_p_o2->currentLoop(), 1); QCOMPARE(a1_p_o3->currentTime(), 250); QCOMPARE(notTimeDriven->currentTime(), 251); QCOMPARE(loopsForever->currentTime(), 1); @@ -589,7 +589,7 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation() group.stop(); - group.setIterationCount(4); + group.setLoopCount(4); stateChangedSpy1.clear(); stateChangedSpy2.clear(); @@ -625,7 +625,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations() loopsForever.setStartValue(0); loopsForever.setEndValue(100); loopsForever.setDuration(100); - loopsForever.setIterationCount(-1); + loopsForever.setLoopCount(-1); QSignalSpy stateChangedSpy(&anim1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); @@ -670,10 +670,10 @@ struct AnimState { #define Stopped QAbstractAnimation::Stopped Q_DECLARE_METATYPE(AnimState) -void tst_QParallelAnimationGroup::iterationCount_data() +void tst_QParallelAnimationGroup::loopCount_data() { QTest::addColumn<bool>("directionBackward"); - QTest::addColumn<int>("setIterationCount"); + QTest::addColumn<int>("setLoopCount"); QTest::addColumn<int>("initialGroupTime"); QTest::addColumn<int>("currentGroupTime"); QTest::addColumn<AnimState>("expected1"); @@ -742,10 +742,10 @@ void tst_QParallelAnimationGroup::iterationCount_data() } -void tst_QParallelAnimationGroup::iterationCount() +void tst_QParallelAnimationGroup::loopCount() { QFETCH(bool, directionBackward); - QFETCH(int, setIterationCount); + QFETCH(int, setLoopCount); QFETCH(int, initialGroupTime); QFETCH(int, currentGroupTime); QFETCH(AnimState, expected1); @@ -763,7 +763,7 @@ void tst_QParallelAnimationGroup::iterationCount() anim2.setStartValue(0); anim2.setEndValue(100); anim2.setDuration(60); //total 120 - anim2.setIterationCount(2); + anim2.setLoopCount(2); TestAnimation anim3; anim3.setStartValue(0); @@ -774,7 +774,7 @@ void tst_QParallelAnimationGroup::iterationCount() group.addAnimation(&anim2); group.addAnimation(&anim3); - group.setIterationCount(setIterationCount); + group.setLoopCount(setLoopCount); if (initialGroupTime >= 0) group.setCurrentTime(initialGroupTime); if (directionBackward) diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index f61df49..2ab0605 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -144,7 +144,7 @@ void tst_QPropertyAnimation::construction() void tst_QPropertyAnimation::setCurrentTime_data() { QTest::addColumn<int>("duration"); - QTest::addColumn<int>("iterationCount"); + QTest::addColumn<int>("loopCount"); QTest::addColumn<int>("currentTime"); QTest::addColumn<int>("testCurrentTime"); QTest::addColumn<int>("testCurrentLoop"); @@ -177,7 +177,7 @@ void tst_QPropertyAnimation::setCurrentTime_data() void tst_QPropertyAnimation::setCurrentTime() { QFETCH(int, duration); - QFETCH(int, iterationCount); + QFETCH(int, loopCount); QFETCH(int, currentTime); QFETCH(int, testCurrentTime); QFETCH(int, testCurrentLoop); @@ -186,11 +186,11 @@ void tst_QPropertyAnimation::setCurrentTime() if (duration < 0) QTest::ignoreMessage(QtWarningMsg, "QVariantAnimation::setDuration: cannot set a negative duration"); animation.setDuration(duration); - animation.setIterationCount(iterationCount); + animation.setLoopCount(loopCount); animation.setCurrentTime(currentTime); QCOMPARE(animation.currentTime(), testCurrentTime); - QCOMPARE(animation.currentIteration(), testCurrentLoop); + QCOMPARE(animation.currentLoop(), testCurrentLoop); } void tst_QPropertyAnimation::statesAndSignals_data() @@ -208,7 +208,7 @@ void tst_QPropertyAnimation::statesAndSignals() QSignalSpy finishedSpy(anim, SIGNAL(finished())); QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - QSignalSpy currentLoopSpy(anim, SIGNAL(currentIterationChanged(int))); + QSignalSpy currentLoopSpy(anim, SIGNAL(currentLoopChanged(int))); anim->setCurrentTime(1); anim->setCurrentTime(100); @@ -217,23 +217,23 @@ void tst_QPropertyAnimation::statesAndSignals() QCOMPARE(currentLoopSpy.count(), 0); QCOMPARE(anim->state(), QAnimationGroup::Stopped); - anim->setIterationCount(3); + anim->setLoopCount(3); anim->setCurrentTime(101); if (uncontrolled) QSKIP("Uncontrolled animations don't handle looping", SkipSingle); QCOMPARE(currentLoopSpy.count(), 1); - QCOMPARE(anim->currentIteration(), 1); + QCOMPARE(anim->currentLoop(), 1); anim->setCurrentTime(0); QCOMPARE(currentLoopSpy.count(), 2); - QCOMPARE(anim->currentIteration(), 0); + QCOMPARE(anim->currentLoop(), 0); anim->start(); QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(runningSpy.count(), 1); //anim must have started - QCOMPARE(anim->currentIteration(), 0); + QCOMPARE(anim->currentLoop(), 0); runningSpy.clear(); anim->stop(); @@ -241,7 +241,7 @@ void tst_QPropertyAnimation::statesAndSignals() QCOMPARE(runningSpy.count(), 1); //anim must have stopped QCOMPARE(finishedSpy.count(), 0); QCOMPARE(anim->currentTime(), 0); - QCOMPARE(anim->currentIteration(), 0); + QCOMPARE(anim->currentLoop(), 0); QCOMPARE(currentLoopSpy.count(), 2); runningSpy.clear(); @@ -252,24 +252,24 @@ void tst_QPropertyAnimation::statesAndSignals() runningSpy.clear(); QCOMPARE(finishedSpy.count(), 1); QCOMPARE(anim->currentTime(), 100); - QCOMPARE(anim->currentIteration(), 2); + QCOMPARE(anim->currentLoop(), 2); QCOMPARE(currentLoopSpy.count(), 4); anim->start(); // auto-rewinds QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(anim->currentTime(), 0); - QCOMPARE(anim->currentIteration(), 0); + QCOMPARE(anim->currentLoop(), 0); QCOMPARE(currentLoopSpy.count(), 5); QCOMPARE(runningSpy.count(), 1); // anim has started QCOMPARE(finishedSpy.count(), 1); - QCOMPARE(anim->currentIteration(), 0); + QCOMPARE(anim->currentLoop(), 0); runningSpy.clear(); QTest::qWait(1000); QCOMPARE(currentLoopSpy.count(), 7); QCOMPARE(anim->state(), QAnimationGroup::Stopped); - QCOMPARE(anim->currentIteration(), 2); + QCOMPARE(anim->currentLoop(), 2); QCOMPARE(runningSpy.count(), 1); // anim has stopped QCOMPARE(finishedSpy.count(), 2); QCOMPARE(anim->currentTime(), 100); @@ -340,7 +340,7 @@ void tst_QPropertyAnimation::deletion2() QCOMPARE(runningSpy.count(), 1); QCOMPARE(finishedSpy.count(), 0); - //we can't call deletaLater directly because the delete would only happen in the next iteration of _this_ event loop + //we can't call deletaLater directly because the delete would only happen in the next loop of _this_ event loop QTimer::singleShot(0, object, SLOT(deleteLater())); QTest::qWait(50); diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 18b57b2..0631343 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -173,7 +173,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); - a2_s_o1->setIterationCount(3); + a2_s_o1->setLoopCount(3); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); sequence->addAnimation(a3_s_o1); @@ -221,7 +221,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 251); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 1); - QCOMPARE(a2_s_o1->currentIteration(), 0); + QCOMPARE(a2_s_o1->currentLoop(), 0); QCOMPARE(a3_s_o1->currentTime(), 0); QCOMPARE(sequence2->currentTime(), 0); QCOMPARE(a1_s_o2->currentTime(), 0); @@ -233,7 +233,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 750); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 0); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 0); QCOMPARE(sequence2->currentTime(), 0); QCOMPARE(a1_s_o2->currentTime(), 0); @@ -245,7 +245,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 1000); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 0); QCOMPARE(sequence2->currentTime(), 0); QCOMPARE(a1_s_o2->currentTime(), 0); @@ -257,7 +257,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 1010); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 10); QCOMPARE(sequence2->currentTime(), 0); QCOMPARE(a1_s_o2->currentTime(), 0); @@ -269,7 +269,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 0); QCOMPARE(a1_s_o2->currentTime(), 0); @@ -281,7 +281,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 250); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -293,7 +293,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 500); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -305,7 +305,7 @@ void tst_QSequentialAnimationGroup::setCurrentTime() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 500); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -330,7 +330,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() QCOMPARE(notTimeDriven->totalDuration(), -1); QVariantAnimation *loopsForever = new QPropertyAnimation(&t_o2, "value"); - loopsForever->setIterationCount(-1); + loopsForever->setLoopCount(-1); QCOMPARE(loopsForever->totalDuration(), -1); QSequentialAnimationGroup group; @@ -436,7 +436,7 @@ void tst_QSequentialAnimationGroup::seekingForwards() QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); - a2_s_o1->setIterationCount(3); + a2_s_o1->setLoopCount(3); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); sequence->addAnimation(a3_s_o1); @@ -476,7 +476,7 @@ void tst_QSequentialAnimationGroup::seekingForwards() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 250); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -498,7 +498,7 @@ void tst_QSequentialAnimationGroup::seekingForwards() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 500); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -516,7 +516,7 @@ void tst_QSequentialAnimationGroup::seekingBackwards() QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); - a2_s_o1->setIterationCount(3); + a2_s_o1->setLoopCount(3); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); sequence->addAnimation(a3_s_o1); @@ -540,7 +540,7 @@ void tst_QSequentialAnimationGroup::seekingBackwards() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 350); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -564,7 +564,7 @@ void tst_QSequentialAnimationGroup::seekingBackwards() QCOMPARE(a2_s_o1->currentTime(), 0); QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children," "hence they don't reset from their current animation", Continue); - QCOMPARE(a2_s_o1->currentIteration(), 0); + QCOMPARE(a2_s_o1->currentLoop(), 0); QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children," "hence they don't reset from their current animation", Continue); QCOMPARE(a3_s_o1->currentTime(), 0); @@ -585,7 +585,7 @@ void tst_QSequentialAnimationGroup::seekingBackwards() QCOMPARE(sequence->currentTime(), 1250); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 2); + QCOMPARE(a2_s_o1->currentLoop(), 2); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(sequence2->currentTime(), 500); QCOMPARE(a1_s_o2->currentTime(), 250); @@ -656,11 +656,11 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QVariantAnimation *a1_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a2_s_o1 = new QPropertyAnimation(&s_o1, "value"); QVariantAnimation *a3_s_o1 = new QPropertyAnimation(&s_o1, "value"); - a2_s_o1->setIterationCount(2); + a2_s_o1->setLoopCount(2); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); sequence->addAnimation(a3_s_o1); - sequence->setIterationCount(2); + sequence->setLoopCount(2); QSignalSpy a1StateChangedSpy(a1_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); QSignalSpy seqStateChangedSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); @@ -675,11 +675,11 @@ void tst_QSequentialAnimationGroup::pauseAndResume() group.setCurrentTime(1751); QCOMPARE(group.currentTime(), 1751); QCOMPARE(sequence->currentTime(), 751); - QCOMPARE(sequence->currentIteration(), 1); + QCOMPARE(sequence->currentLoop(), 1); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 1); - QCOMPARE(a3_s_o1->currentIteration(), 0); + QCOMPARE(a2_s_o1->currentLoop(), 1); + QCOMPARE(a3_s_o1->currentLoop(), 0); QCOMPARE(a3_s_o1->currentTime(), 1); QCOMPARE(group.state(), QAnimationGroup::Paused); @@ -723,11 +723,11 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QVERIFY(group.currentTime() >= 1751); QVERIFY(sequence->currentTime() >= 751); - QCOMPARE(sequence->currentIteration(), 1); + QCOMPARE(sequence->currentLoop(), 1); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 1); - QCOMPARE(a3_s_o1->currentIteration(), 0); + QCOMPARE(a2_s_o1->currentLoop(), 1); + QCOMPARE(a3_s_o1->currentLoop(), 0); QVERIFY(a3_s_o1->currentTime() >= 1); QCOMPARE(seqStateChangedSpy.count(), 3); // Running,Paused,Running @@ -744,11 +744,11 @@ void tst_QSequentialAnimationGroup::pauseAndResume() QVERIFY(group.currentTime() >= 1751); QVERIFY(sequence->currentTime() >= 751); - QCOMPARE(sequence->currentIteration(), 1); + QCOMPARE(sequence->currentLoop(), 1); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 1); - QCOMPARE(a3_s_o1->currentIteration(), 0); + QCOMPARE(a2_s_o1->currentLoop(), 1); + QCOMPARE(a3_s_o1->currentLoop(), 0); QVERIFY(a3_s_o1->currentTime() >= 1); QCOMPARE(seqStateChangedSpy.count(), 4); // Running,Paused,Running,Paused @@ -780,11 +780,11 @@ void tst_QSequentialAnimationGroup::restart() animsStateChanged[i] = new QSignalSpy(anims[i], SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); } - anims[1]->setIterationCount(2); + anims[1]->setLoopCount(2); sequence->addAnimation(anims[0]); sequence->addAnimation(anims[1]); sequence->addAnimation(anims[2]); - sequence->setIterationCount(2); + sequence->setLoopCount(2); QSequentialAnimationGroup group; group.addAnimation(sequence); @@ -845,17 +845,17 @@ void tst_QSequentialAnimationGroup::looping() QSignalSpy a3Spy(a3_s_o1, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); QSignalSpy seqSpy(sequence, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); - a2_s_o1->setIterationCount(2); + a2_s_o1->setLoopCount(2); sequence->addAnimation(a1_s_o1); sequence->addAnimation(a2_s_o1); sequence->addAnimation(a3_s_o1); - sequence->setIterationCount(2); + sequence->setLoopCount(2); QSequentialAnimationGroup group; QSignalSpy groupSpy(&group, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); group.addAnimation(sequence); - group.setIterationCount(2); + group.setLoopCount(2); group.start(); group.pause(); @@ -864,12 +864,12 @@ void tst_QSequentialAnimationGroup::looping() group.setCurrentTime(1750); QCOMPARE(group.currentTime(), 1750); QCOMPARE(sequence->currentTime(), 750); - QCOMPARE(sequence->currentIteration(), 1); + QCOMPARE(sequence->currentLoop(), 1); QCOMPARE(a1_s_o1->currentTime(), 250); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 1); + QCOMPARE(a2_s_o1->currentLoop(), 1); // this animation is at the beginning because it is the current one inside sequence - QCOMPARE(a3_s_o1->currentIteration(), 0); + QCOMPARE(a3_s_o1->currentLoop(), 0); QCOMPARE(a3_s_o1->currentTime(), 0); QCOMPARE(sequence->currentAnimation(), a3_s_o1); @@ -898,14 +898,14 @@ void tst_QSequentialAnimationGroup::looping() // Looping, current time = duration + 1 group.setCurrentTime(group.duration() + 1); QCOMPARE(group.currentTime(), 1); - QCOMPARE(group.currentIteration(), 1); + QCOMPARE(group.currentLoop(), 1); QCOMPARE(sequence->currentTime(), 1); - QCOMPARE(sequence->currentIteration(), 0); + QCOMPARE(sequence->currentLoop(), 0); QCOMPARE(a1_s_o1->currentTime(), 1); QCOMPARE(a2_s_o1->currentTime(), 250); - QCOMPARE(a2_s_o1->currentIteration(), 1); + QCOMPARE(a2_s_o1->currentLoop(), 1); // this animation is at the end because it was run on the previous loop - QCOMPARE(a3_s_o1->currentIteration(), 0); + QCOMPARE(a3_s_o1->currentLoop(), 0); QCOMPARE(a3_s_o1->currentTime(), 250); QCOMPARE(group.state(), QAnimationGroup::Paused); @@ -1367,7 +1367,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation() group.addAnimation(anim1); group.addAnimation(anim2); group.addAnimation(anim3); - group.setIterationCount(2); + group.setLoopCount(2); group.start(); QCOMPARE(stateChangedSpy.count(), 2); @@ -1401,7 +1401,7 @@ void tst_QSequentialAnimationGroup::stopUncontrolledAnimations() loopsForever.setStartValue(0); loopsForever.setEndValue(100); loopsForever.setDuration(100); - loopsForever.setIterationCount(-1); + loopsForever.setLoopCount(-1); group.addAnimation(¬TimeDriven); group.addAnimation(&loopsForever); @@ -1592,11 +1592,11 @@ void tst_QSequentialAnimationGroup::currentAnimationWithZeroDuration() void tst_QSequentialAnimationGroup::insertAnimation() { QSequentialAnimationGroup group; - group.setIterationCount(2); + group.setLoopCount(2); QPropertyAnimation *anim = new QPropertyAnimation(&group); QCOMPARE(group.duration(), anim->duration()); group.setCurrentTime(300); - QCOMPARE(group.currentIteration(), 1); + QCOMPARE(group.currentLoop(), 1); //this will crash if the sequential group calls duration on the created animation new QPropertyAnimation(&group); |