summaryrefslogtreecommitdiffstats
path: root/src/corelib/animation/qabstractanimation.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-11-04 14:40:28 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-11-04 14:43:24 (GMT)
commit3ac785411d860e48e14f6b2542b666a6d508cff1 (patch)
tree6f01357f5d7317db6bafb611d9cef2002054f07a /src/corelib/animation/qabstractanimation.cpp
parentff1bd9c821aa1e314d6ca738204cdd0ae60a8369 (diff)
downloadQt-3ac785411d860e48e14f6b2542b666a6d508cff1.zip
Qt-3ac785411d860e48e14f6b2542b666a6d508cff1.tar.gz
Qt-3ac785411d860e48e14f6b2542b666a6d508cff1.tar.bz2
Result API review with Jasmin
QAbstractAnimation: currentTime returns the "complete" current time currentLoopTime() returns the time inside the current loop add setPaused(bool) for consistency with QTimeLine stateChanged: newState passed as first paramater (before oldState) for consistency with the reset of Qt QAnimationGroup: rename clearAnimations to clear rename insertAnimationAt to insertAnimation rename takeAnimationAt to takeAnimation QSequentialAnimationGroup: rename insertPauseAt to insertPause
Diffstat (limited to 'src/corelib/animation/qabstractanimation.cpp')
-rw-r--r--src/corelib/animation/qabstractanimation.cpp46
1 files changed, 35 insertions, 11 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 4f93c1e..0cdc40c 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -115,7 +115,7 @@
*/
/*!
- \fn QAbstractAnimation::stateChanged(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
+ \fn QAbstractAnimation::stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
QAbstractAnimation emits this signal whenever the state of the animation has
changed from \a oldState to \a newState. This signal is emitted after the virtual
@@ -357,12 +357,12 @@ void QAbstractAnimationPrivate::setState(QAbstractAnimation::State newState)
QUnifiedTimer::instance()->unregisterAnimation(q);
}
- q->updateState(oldState, newState);
+ q->updateState(newState, oldState);
if (!guard || newState != state) //this is to be safe if updateState changes the state
return;
// Notify state change
- emit q->stateChanged(oldState, newState);
+ emit q->stateChanged(newState, oldState);
if (!guard || newState != state) //this is to be safe if updateState changes the state
return;
@@ -635,6 +635,18 @@ int QAbstractAnimation::totalDuration() const
}
/*!
+ Returns the current time inside the current loop. It can go from 0 to duration().
+
+ \sa duration(), currentTime
+*/
+
+int QAbstractAnimation::currentLoopTime() const
+{
+ Q_D(const QAbstractAnimation);
+ return d->currentTime;
+}
+
+/*!
\property QAbstractAnimation::currentTime
\brief the current time and progress of the animation
@@ -643,17 +655,14 @@ int QAbstractAnimation::totalDuration() const
the animation run, setting the current time automatically as the animation
progresses.
- The animation's current time starts at 0, and ends at duration(). If the
- 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.
+ The animation's current time starts at 0, and ends at totalDuration().
- \sa loopCount
+ \sa loopCount, currentLoopTime
*/
int QAbstractAnimation::currentTime() const
{
Q_D(const QAbstractAnimation);
- return d->currentTime;
+ return d->totalCurrentTime;
}
void QAbstractAnimation::setCurrentTime(int msecs)
{
@@ -777,6 +786,21 @@ void QAbstractAnimation::resume()
}
/*!
+ If \a paused is true, the animation is paused.
+ If \a paused is false, the animation is resumed.
+
+ \sa state(), pause(), resume()
+*/
+void QAbstractAnimation::setPaused(bool paused)
+{
+ if (paused)
+ pause();
+ else
+ resume();
+}
+
+
+/*!
\reimp
*/
bool QAbstractAnimation::event(QEvent *event)
@@ -799,8 +823,8 @@ bool QAbstractAnimation::event(QEvent *event)
\sa start(), stop(), pause(), resume()
*/
-void QAbstractAnimation::updateState(QAbstractAnimation::State oldState,
- QAbstractAnimation::State newState)
+void QAbstractAnimation::updateState(QAbstractAnimation::State newState,
+ QAbstractAnimation::State oldState)
{
Q_UNUSED(oldState);
Q_UNUSED(newState);