diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-11-28 10:57:45 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-12-14 19:46:05 +0000 |
commit | d49ab00f2b9c99da48d9ddef2b0627a86d54b95e (patch) | |
tree | dde0f77d4353f3cc6adfef085ba19ab78ac7bc57 /src/quicktemplates2/qquickswipe_p.h | |
parent | bc6414762e48f12f6680ee6bb667c49c64fbd32a (diff) |
SwipeDelegate: transition swipe.position
Previously the value of swipe.position jumped on mouse/touch release,
or when open() or close() was called. Transitioning the swipe.position
value smoothly to the target value makes it possible to use it as
opacity/scale/etc. for the side items.
Notice that this is backwards compatible with the old behavior. If no
transition is set, the value jumps the same way it did before. In that
case, Behavior on x makes the movement smooth.
Task-number: QTBUG-57242
Change-Id: Id9c06b5b08fa73f2f575787e16dc6e20e4ccb545
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickswipe_p.h')
-rw-r--r-- | src/quicktemplates2/qquickswipe_p.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickswipe_p.h b/src/quicktemplates2/qquickswipe_p.h index bedf5b1f..2201bb06 100644 --- a/src/quicktemplates2/qquickswipe_p.h +++ b/src/quicktemplates2/qquickswipe_p.h @@ -56,12 +56,13 @@ QT_BEGIN_NAMESPACE class QQmlComponent; class QQuickItem; +class QQuickTransition; class QQuickSwipePrivate; class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject { Q_OBJECT - Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL) + Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL) Q_PROPERTY(bool complete READ isComplete NOTIFY completeChanged FINAL) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL) // REVISION 2 Q_PROPERTY(QQmlComponent *left READ left WRITE setLeft NOTIFY leftChanged FINAL) @@ -70,6 +71,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject Q_PROPERTY(QQuickItem *leftItem READ leftItem NOTIFY leftItemChanged FINAL) Q_PROPERTY(QQuickItem *behindItem READ behindItem NOTIFY behindItemChanged FINAL) Q_PROPERTY(QQuickItem *rightItem READ rightItem NOTIFY rightItemChanged FINAL) + Q_PROPERTY(QQuickTransition *rebound READ rebound WRITE setRebound NOTIFY reboundChanged FINAL) // REVISION 2 public: explicit QQuickSwipe(QQuickSwipeDelegate *control); @@ -101,6 +103,9 @@ public: QQuickItem *rightItem() const; void setRightItem(QQuickItem *item); + QQuickTransition *rebound() const; + void setRebound(QQuickTransition *rebound); + Q_REVISION(2) Q_INVOKABLE void open(QQuickSwipeDelegate::Side side); Q_REVISION(1) Q_INVOKABLE void close(); @@ -115,6 +120,7 @@ Q_SIGNALS: void leftItemChanged(); void behindItemChanged(); void rightItemChanged(); + /*Q_REVISION(2)*/ void reboundChanged(); private: Q_DISABLE_COPY(QQuickSwipe) |