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 | |
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')
-rw-r--r-- | src/corelib/animation/qpropertyanimation.cpp | 22 | ||||
-rw-r--r-- | src/corelib/animation/qvariantanimation_p.h | 14 |
2 files changed, 16 insertions, 20 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" diff --git a/src/corelib/animation/qvariantanimation_p.h b/src/corelib/animation/qvariantanimation_p.h index 66910c1..14a3ef6 100644 --- a/src/corelib/animation/qvariantanimation_p.h +++ b/src/corelib/animation/qvariantanimation_p.h @@ -88,18 +88,6 @@ public: return q->d_func(); } - - //some helper functions - bool atBeginning() const - { - return currentTime == 0; - } - - bool atEnd() const - { - return currentTime == duration && currentLoop == (loopCount - 1); - } - void setDefaultStartValue(const QVariant &value); int duration; @@ -109,7 +97,7 @@ public: QVariant currentValue; QVariant defaultStartValue; bool hasStartValue; - + //this is used to keep track of the KeyValue interval in which we currently are struct { |