diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-04-22 23:23:33 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-04-22 23:23:33 (GMT) |
commit | c41be719a15cd8d702dd1064fee2b224f657c067 (patch) | |
tree | 6cb88f763194a66e4c5c7bf5797614f47b3d4671 /src/corelib/animation/qpropertyanimation.cpp | |
parent | a1458a0426caa71bab4527ca079c3004bb2b5abd (diff) | |
parent | ebda84cd06faaf440a096bda7966fa795ca86318 (diff) | |
download | Qt-c41be719a15cd8d702dd1064fee2b224f657c067.zip Qt-c41be719a15cd8d702dd1064fee2b224f657c067.tar.gz Qt-c41be719a15cd8d702dd1064fee2b224f657c067.tar.bz2 |
Merge branch 'kinetic-animations' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
src/gui/animation/qguivariantanimation.cpp
Diffstat (limited to 'src/corelib/animation/qpropertyanimation.cpp')
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp index edcabaa..9a0c5bc 100644 --- a/src/corelib/animation/qpropertyanimation.cpp +++ b/src/corelib/animation/qpropertyanimation.cpp @@ -49,7 +49,7 @@ by itself as a simple animation class, or as part of more complex animations through QAnimationGroup. - The most common way to use QPropertyAnimation is to construct an instance + The most common way to use QPropertyAnimation is to construct an instance of it by passing a pointer to a QObject or a QWidget, and the name of the property you would like to animate to QPropertyAnimation's constructor. @@ -220,11 +220,20 @@ void QPropertyAnimation::updateCurrentValue(const QVariant &value) /*! \reimp + + If the startValue is not defined when the state of the animation changes from Stopped to Running, + the current property value is used as the initial value for the animation. */ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState) { Q_D(QPropertyAnimation); + + if (!d->target) { + qWarning("QPropertyAnimation::updateState: Changing state of an animation without target"); + return; + } + QVariantAnimation::updateState(oldState, newState); QMutexLocker locker(guardHashLock()); QPropertyAnimationHash * hash = _q_runningAnimations(); @@ -235,20 +244,19 @@ void QPropertyAnimation::updateState(QAbstractAnimation::State oldState, if (oldAnim) { // try to stop the top level group QAbstractAnimation *current = oldAnim; - while(current->group() && current->state() != Stopped) current = current->group(); + while (current->group() && current->state() != Stopped) + current = current->group(); current->stop(); } hash->insert(key, this); - // Initialize start value - // ### review this line below, d->atEnd() ? - // ### avoid entering a state where start value is not set - if (d->target && (d->atBeginning() || d->atEnd())) { + + // update the default start value + if (oldState == Stopped) { d->setDefaultStartValue(d->target->property(d->propertyName.constData())); } } else if (hash->value(key) == this) { hash->remove(key); } - } #include "moc_qpropertyanimation.cpp" |