diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-09-10 03:21:36 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-09-10 03:21:36 (GMT) |
commit | 2c0255521f00a1fd95988161a03c39631350eaba (patch) | |
tree | 20947c82c768b3aa785628e92ae0ee7a0ac3bfbd /src/declarative/util/qmleasefollow.cpp | |
parent | c494da05e1d3cb597990098e9713a0af5364c828 (diff) | |
download | Qt-2c0255521f00a1fd95988161a03c39631350eaba.zip Qt-2c0255521f00a1fd95988161a03c39631350eaba.tar.gz Qt-2c0255521f00a1fd95988161a03c39631350eaba.tar.bz2 |
Follow renamed to SpringFollow.
Diffstat (limited to 'src/declarative/util/qmleasefollow.cpp')
-rw-r--r-- | src/declarative/util/qmleasefollow.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/declarative/util/qmleasefollow.cpp b/src/declarative/util/qmleasefollow.cpp index 83dbde7..b58ad14 100644 --- a/src/declarative/util/qmleasefollow.cpp +++ b/src/declarative/util/qmleasefollow.cpp @@ -56,7 +56,7 @@ public: QmlEaseFollowPrivate() : source(0), velocity(200), duration(-1), reversingMode(QmlEaseFollow::Eased), initialVelocity(0), - initialValue(0), invert(false), trackVelocity(0), clockOffset(0), + initialValue(0), invert(false), enabled(true), trackVelocity(0), clockOffset(0), lastTick(0), clock(this) {} @@ -68,6 +68,7 @@ public: qreal initialVelocity; qreal initialValue; bool invert; + bool enabled; qreal trackVelocity; @@ -267,7 +268,7 @@ qreal QmlEaseFollow::sourceValue() const /*! \qmlproperty enumeration EaseFollow::reversingMode - Sets how the EaseFollow behaves if an animation diration is reversed. + Sets how the EaseFollow behaves if an animation direction is reversed. If reversing mode is \c Eased, the animation will smoothly decelerate, and then reverse direction. If the reversing mode is \c Immediate, the @@ -289,6 +290,9 @@ void QmlEaseFollow::setReversingMode(ReversingMode m) void QmlEaseFollowPrivate::restart() { + if (!enabled) + return; + initialValue = target.read().toReal(); if (source == initialValue) { @@ -382,6 +386,26 @@ void QmlEaseFollow::setVelocity(qreal v) d->restart(); } +/*! + \qmlproperty bool EaseFollow::enabled + This property holds whether the target will track the source. +*/ +bool QmlEaseFollow::enabled() const +{ + Q_D(const QmlEaseFollow); + return d->enabled; +} + +void QmlEaseFollow::setEnabled(bool enabled) +{ + Q_D(QmlEaseFollow); + d->enabled = enabled; + if (enabled) + d->restart(); + else + d->clockStop(); +} + void QmlEaseFollow::setTarget(const QmlMetaProperty &t) { Q_D(QmlEaseFollow); |