diff options
Diffstat (limited to 'src/declarative/util')
-rw-r--r-- | src/declarative/util/qmlfollow.cpp | 16 | ||||
-rw-r--r-- | src/declarative/util/qmlfollow.h | 6 |
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); |