diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-11-23 14:46:06 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-11-24 12:12:32 +0000 |
commit | 29cf234ce28e4fcf26b60e906e1f4ae23eab5f54 (patch) | |
tree | 2f6be8c0335dcd86ec02c2f3fd98912237f175d2 /src/quick/handlers/qquickpointerhandler_p.h | |
parent | 7aa312be3ce7ff8f7f4b8e484747565c2cae88a7 (diff) |
QQuickPointerHandler: add read-only parent property
The parent is the Item in which the handler is instantiated.
It cannot (so far) be reassigned to a different item, so this is not
the same as QQuickItem's parent property: it's rather a convenience
to get the QObject parent and cast it.
Change-Id: Ib352213589532f45f104c8d83f04fd14107a4a20
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickpointerhandler_p.h')
-rw-r--r-- | src/quick/handlers/qquickpointerhandler_p.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index 42d9489f84..5e691bea5e 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -66,6 +66,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerHandler : public QObject Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_PROPERTY(bool active READ active NOTIFY activeChanged) Q_PROPERTY(QQuickItem * target READ target WRITE setTarget NOTIFY targetChanged) + Q_PROPERTY(QQuickItem * parent READ parentItem CONSTANT) public: QQuickPointerHandler(QObject *parent = 0); @@ -80,6 +81,8 @@ public: QQuickItem *target() const { return m_target; } void setTarget(QQuickItem *target); + QQuickItem * parentItem() const { return static_cast<QQuickItem *>(QObject::parent()); } + void handlePointerEvent(QQuickPointerEvent *event); Q_SIGNALS: |