summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmleasefollow.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-09-10 03:21:36 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-09-10 03:21:36 (GMT)
commit2c0255521f00a1fd95988161a03c39631350eaba (patch)
tree20947c82c768b3aa785628e92ae0ee7a0ac3bfbd /src/declarative/util/qmleasefollow.cpp
parentc494da05e1d3cb597990098e9713a0af5364c828 (diff)
downloadQt-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.cpp28
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);