summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-04-23 06:52:07 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-04-23 06:52:07 (GMT)
commit161cf1f17eabd87e46c2056af731174e930883dd (patch)
tree10962a2c7977b6f5de5c3c8f77a10f304eea918c /src/declarative/util
parent5b6160e55087a2800d47eece3c5555595068587c (diff)
downloadQt-161cf1f17eabd87e46c2056af731174e930883dd.zip
Qt-161cf1f17eabd87e46c2056af731174e930883dd.tar.gz
Qt-161cf1f17eabd87e46c2056af731174e930883dd.tar.bz2
Add a Follow::followValue property
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qmlfollow.cpp16
-rw-r--r--src/declarative/util/qmlfollow.h6
2 files changed, 22 insertions, 0 deletions
diff --git a/src/declarative/util/qmlfollow.cpp b/src/declarative/util/qmlfollow.cpp
index c841b85..01d8962 100644
--- a/src/declarative/util/qmlfollow.cpp
+++ b/src/declarative/util/qmlfollow.cpp
@@ -52,6 +52,7 @@ QML_DEFINE_TYPE(QmlFollow,Follow);
class QmlFollowPrivate : public QObjectPrivate
{
+ Q_DECLARE_PUBLIC(QmlFollow)
public:
QmlFollowPrivate()
: sourceValue(0), maxVelocity(0), lastTime(0)
@@ -86,6 +87,8 @@ public:
void QmlFollowPrivate::tick(int time)
{
+ Q_Q(QmlFollow);
+
int elapsed = time - lastTime;
if (!elapsed)
return;
@@ -133,6 +136,7 @@ void QmlFollowPrivate::tick(int time)
}
lastTime = time;
}
+ emit q->valueChanged(currentValue);
property.write(currentValue);
}
@@ -288,6 +292,11 @@ void QmlFollow::setDamping(qreal damping)
}
/*!
+ \qmlproperty qreal Follow::followValue
+ The current value.
+*/
+
+/*!
\qmlproperty bool Follow::enabled
This property holds whether the target will track the source.
*/
@@ -306,4 +315,11 @@ void QmlFollow::setEnabled(bool enabled)
else
d->stop();
}
+
+qreal QmlFollow::value() const
+{
+ Q_D(const QmlFollow);
+ return d->currentValue;
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/util/qmlfollow.h b/src/declarative/util/qmlfollow.h
index a609305..aac4c01 100644
--- a/src/declarative/util/qmlfollow.h
+++ b/src/declarative/util/qmlfollow.h
@@ -65,6 +65,7 @@ class Q_DECLARATIVE_EXPORT QmlFollow : public QmlPropertyValueSource,
Q_PROPERTY(qreal damping READ damping WRITE setDamping);
Q_PROPERTY(bool enabled READ enabled WRITE setEnabled);
+ Q_PROPERTY(qreal followValue READ value NOTIFY valueChanged);
public:
QmlFollow(QObject *parent=0);
~QmlFollow();
@@ -81,6 +82,11 @@ public:
void setDamping(qreal damping);
bool enabled() const;
void setEnabled(bool enabled);
+
+ qreal value() const;
+
+Q_SIGNALS:
+ void valueChanged(qreal);
};
QML_DECLARE_TYPE(QmlFollow);