aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquickswipedelegate_p.h
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-07-12 10:18:21 +0200
committerMitch Curtis <mitch.curtis@qt.io>2016-07-14 14:43:04 +0000
commit4ac9693ef809f7b335bff273905da006c9fee252 (patch)
tree9154220547ff5ccf7e7ae41af88e332d83952e58 /src/quicktemplates2/qquickswipedelegate_p.h
parentbc86a96c56934d98d641844319a905753f56895a (diff)
SwipeDelegate: add swipe.pressed and swipe.clicked()
These allow users to detect when non-interactive left/right/behind items are being pressed and clicked. [ChangeLog][SwipeDelegate] Added swipe.pressed and swipe.clicked() for detecting when non-interactive left/right/behind items are pressed and clicked. Change-Id: I858f0a8e4f85b3f80f93eb4f1680d8e121acdd41 Task-number: QTBUG-54651 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quicktemplates2/qquickswipedelegate_p.h')
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickswipedelegate_p.h b/src/quicktemplates2/qquickswipedelegate_p.h
index f94219cd..7ef995d1 100644
--- a/src/quicktemplates2/qquickswipedelegate_p.h
+++ b/src/quicktemplates2/qquickswipedelegate_p.h
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
class QQuickSwipeDelegatePrivate;
class QQuickSwipe;
+class QQuickSwipeDelegateAttached;
+class QQuickSwipeDelegateAttachedPrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeDelegate : public QQuickItemDelegate
{
@@ -65,6 +67,8 @@ public:
QQuickSwipe *swipe() const;
+ static QQuickSwipeDelegateAttached *qmlAttachedProperties(QObject *object);
+
protected:
bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
@@ -141,8 +145,29 @@ private:
Q_DECLARE_PRIVATE(QQuickSwipe)
};
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeDelegateAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
+
+public:
+ explicit QQuickSwipeDelegateAttached(QObject *object = nullptr);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+Q_SIGNALS:
+ void pressedChanged();
+ void clicked();
+
+private:
+ Q_DISABLE_COPY(QQuickSwipeDelegateAttached)
+ Q_DECLARE_PRIVATE(QQuickSwipeDelegateAttached)
+};
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickSwipeDelegate)
+QML_DECLARE_TYPEINFO(QQuickSwipeDelegate, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKSWIPEDELEGATE_P_H