aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-07-12 09:22:24 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-07-13 20:12:06 +0000
commita26244b5c34c2d3415f19929dd8519305d191a09 (patch)
tree4dfe9fbb4ddc7187db3cebcb4cc961a9ad58d5fd /src/quicktemplates2
parent546544b347be496a484101b1b7c05e3c6bdbc9e9 (diff)
SwipeDelegate: add swipe.completed() signal
This allows users to respond to completion of the swipe by e.g. removing the item from the list it is in. [ChangeLog][SwipeDelegate] Added swipe.completed() for responding to completion of swipes. Change-Id: I3d605f18a1aff8892a6e088188b606a630e99506 Task-number: QTBUG-54651 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp13
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index a9f6ac08..a8ba2e80 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -520,6 +520,8 @@ void QQuickSwipe::setComplete(bool complete)
d->complete = complete;
emit completeChanged();
+ if (d->complete)
+ emit completed();
}
void QQuickSwipe::close()
@@ -721,7 +723,7 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
\table
\header
- \li Property/Method
+ \li Name
\li Description
\row
\li position
@@ -784,6 +786,15 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
and \l {Control::}{background} will be triggered.
This method was added in QtQuick.Controls 2.1.
+ \row
+ \li completed()
+ \li This signal is emitted when \c complete becomes \c true.
+
+ It is useful for performing some action upon completion of a swipe.
+ For example, it can be used to remove the delegate from the list
+ that it is in.
+
+ This signal was added in QtQuick.Controls 2.1.
\endtable
\sa {Control::}{contentItem}, {Control::}{background}
diff --git a/src/quicktemplates2/qquickswipedelegate_p.h b/src/quicktemplates2/qquickswipedelegate_p.h
index afd195ea..f94219cd 100644
--- a/src/quicktemplates2/qquickswipedelegate_p.h
+++ b/src/quicktemplates2/qquickswipedelegate_p.h
@@ -128,6 +128,7 @@ public:
Q_SIGNALS:
void positionChanged();
void completeChanged();
+ Q_REVISION(1) void completed();
void leftChanged();
void behindChanged();
void rightChanged();