summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-09-09 08:11:09 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-09-09 08:38:47 (GMT)
commit3146eab715817e25abc3c43232ddaa6602f1aefb (patch)
tree2a23fd451e154640ae0113efe986084b3af9f234
parente7831cacd42f84eecff287c8df0b049f41b45bb7 (diff)
downloadQt-3146eab715817e25abc3c43232ddaa6602f1aefb.zip
Qt-3146eab715817e25abc3c43232ddaa6602f1aefb.tar.gz
Qt-3146eab715817e25abc3c43232ddaa6602f1aefb.tar.bz2
Update running animations if a SmoothedAnimation is changed
This behavior is consistent with the other animations. Task-number: QTBUG-12336 Reviewed-by: Leonardo Sobral Cunha
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation.cpp20
-rw-r--r--src/declarative/util/qdeclarativesmoothedanimation_p_p.h1
2 files changed, 20 insertions, 1 deletions
diff --git a/src/declarative/util/qdeclarativesmoothedanimation.cpp b/src/declarative/util/qdeclarativesmoothedanimation.cpp
index fbd0762..ca83c52 100644
--- a/src/declarative/util/qdeclarativesmoothedanimation.cpp
+++ b/src/declarative/util/qdeclarativesmoothedanimation.cpp
@@ -312,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);
@@ -341,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();
@@ -395,6 +405,7 @@ void QDeclarativeSmoothedAnimation::setReversingMode(ReversingMode m)
d->anim->reversingMode = m;
emit reversingModeChanged();
+ d->updateRunningAnimations();
}
/*!
@@ -418,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
@@ -447,6 +461,7 @@ void QDeclarativeSmoothedAnimation::setVelocity(qreal v)
d->anim->velocity = v;
emit velocityChanged();
+ d->updateRunningAnimations();
}
/*!
@@ -468,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;