diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-09 09:41:01 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-09 09:41:01 (GMT) |
commit | 098c952dac34ff2a82e07ccf54056f74f9208ba5 (patch) | |
tree | 8af9b4ef061223048f56fa31a61c33e570431528 /src/declarative | |
parent | 6919e1e9d36d83958750a42e1f8d567f2f74299e (diff) | |
parent | 9a5885d3876375a7ca2c135ff4ec7ea93005227f (diff) | |
download | Qt-098c952dac34ff2a82e07ccf54056f74f9208ba5.zip Qt-098c952dac34ff2a82e07ccf54056f74f9208ba5.tar.gz Qt-098c952dac34ff2a82e07ccf54056f74f9208ba5.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Update running animations if a SmoothedAnimation is changed
Fix SmoothedAnimation test and docs
Fix qdeclarativeimageprovider autotest compilation on Symbian
Fix reversingModes of QDeclarativeSmoothedAnimation
Re-add quit button to declarative Twitter demo
Recreate Qt 4.7.0 def files over Qt 4.6.3
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qdeclarativesmoothedanimation.cpp | 33 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativesmoothedanimation_p_p.h | 1 |
2 files changed, 30 insertions, 4 deletions
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp index b2f02e6..ca83c52 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation.cpp +++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp @@ -214,22 +214,23 @@ void QSmoothedAnimation::init() } bool hasReversed = trackVelocity != 0. && - ((trackVelocity > 0) == ((initialValue - to) > 0)); + ((!invert) == ((initialValue - to) > 0)); if (hasReversed) { switch (reversingMode) { default: case QDeclarativeSmoothedAnimation::Eased: + initialVelocity = -trackVelocity; break; case QDeclarativeSmoothedAnimation::Sync: QDeclarativePropertyPrivate::write(target, to, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); + trackVelocity = 0; stop(); return; case QDeclarativeSmoothedAnimation::Immediate: initialVelocity = 0; - delayedStop(); break; } } @@ -311,6 +312,17 @@ QDeclarativeSmoothedAnimationPrivate::QDeclarativeSmoothedAnimationPrivate() QDeclarative_setParent_noEvent(anim, q); } +void QDeclarativeSmoothedAnimationPrivate::updateRunningAnimations() +{ + foreach(QSmoothedAnimation* ease, activeAnimations.values()){ + ease->maximumEasingTime = anim->maximumEasingTime; + ease->reversingMode = anim->reversingMode; + ease->velocity = anim->velocity; + ease->userDuration = anim->userDuration; + ease->init(); + } +} + QAbstractAnimation* QDeclarativeSmoothedAnimation::qtAnimation() { Q_D(QDeclarativeSmoothedAnimation); @@ -340,7 +352,6 @@ void QDeclarativeSmoothedAnimation::transition(QDeclarativeStateActions &actions ease = d->activeAnimations.value((*d->actions)[i].property); needsRestart = true; } - ease->target = (*d->actions)[i].property; ease->to = (*d->actions)[i].toValue.toReal(); @@ -394,6 +405,7 @@ void QDeclarativeSmoothedAnimation::setReversingMode(ReversingMode m) d->anim->reversingMode = m; emit reversingModeChanged(); + d->updateRunningAnimations(); } /*! @@ -402,6 +414,9 @@ void QDeclarativeSmoothedAnimation::setReversingMode(ReversingMode m) This property holds the animation duration, in msecs, used when tracking the source. Setting this to -1 (the default) disables the duration value. + + If the velocity value and the duration value are both enabled, then the animation will + use whichever gives the shorter duration. */ int QDeclarativeSmoothedAnimation::duration() const { @@ -414,7 +429,10 @@ void QDeclarativeSmoothedAnimation::setDuration(int duration) Q_D(QDeclarativeSmoothedAnimation); if (duration != -1) QDeclarativeNumberAnimation::setDuration(duration); + if(duration == d->anim->userDuration) + return; d->anim->userDuration = duration; + d->updateRunningAnimations(); } qreal QDeclarativeSmoothedAnimation::velocity() const @@ -431,6 +449,9 @@ qreal QDeclarativeSmoothedAnimation::velocity() const The default velocity of SmoothedAnimation is 200 units/second. Setting this to -1 disables the velocity value. + + If the velocity value and the duration value are both enabled, then the animation will + use whichever gives the shorter duration. */ void QDeclarativeSmoothedAnimation::setVelocity(qreal v) { @@ -440,12 +461,13 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v) d->anim->velocity = v; emit velocityChanged(); + d->updateRunningAnimations(); } /*! \qmlproperty int SmoothedAnimation::maximumEasingTime - This property specifies the maximum time, in msecs, an "eases" during the follow should take. + This property specifies the maximum time, in msecs, any "eases" during the follow should take. Setting this property causes the velocity to "level out" after at a time. Setting a negative value reverts to the normal mode of easing over the entire animation duration. @@ -461,8 +483,11 @@ int QDeclarativeSmoothedAnimation::maximumEasingTime() const void QDeclarativeSmoothedAnimation::setMaximumEasingTime(int v) { Q_D(QDeclarativeSmoothedAnimation); + if(v == d->anim->maximumEasingTime) + return; d->anim->maximumEasingTime = v; emit maximumEasingTimeChanged(); + d->updateRunningAnimations(); } QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativesmoothedanimation_p_p.h b/src/declarative/util/qdeclarativesmoothedanimation_p_p.h index 8cdbea2..cb0f4c2 100644 --- a/src/declarative/util/qdeclarativesmoothedanimation_p_p.h +++ b/src/declarative/util/qdeclarativesmoothedanimation_p_p.h @@ -123,6 +123,7 @@ class QDeclarativeSmoothedAnimationPrivate : public QDeclarativePropertyAnimatio Q_DECLARE_PUBLIC(QDeclarativeSmoothedAnimation) public: QDeclarativeSmoothedAnimationPrivate(); + void updateRunningAnimations(); QParallelAnimationGroup *wrapperGroup; QSmoothedAnimation *anim; |