diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-04-24 01:48:50 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-04-24 01:48:50 (GMT) |
commit | 53fd3ca280c85572d5f38e0f2809e7601578d41e (patch) | |
tree | 1be69e09b3e95b7cd05410040ea8e44f4b1239b8 /src/declarative/util | |
parent | 4001e0caa232f4c0624c28710c954e78264f4d7d (diff) | |
parent | 19a507c5cc8c178a0e00fa302f6315c4b18b50a5 (diff) | |
download | Qt-53fd3ca280c85572d5f38e0f2809e7601578d41e.zip Qt-53fd3ca280c85572d5f38e0f2809e7601578d41e.tar.gz Qt-53fd3ca280c85572d5f38e0f2809e7601578d41e.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
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); |