aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents_p_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-07-18 15:50:21 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2016-07-19 14:52:28 +0000
commit3fa5a9c0113f381cedb1b9d82d82bdd2289c57c0 (patch)
treee1c26195608fc7a4c2fdd68aab79b07096a7bb0d /src/quick/items/qquickevents_p_p.h
parent90de20f17fc1b3690a263372b222682e5292e857 (diff)
QQuickEventPoint: be a QObject-child of QQuickPointerEvent
The points are conceptually children, so this will help take care of memory management. It's also useful to be able to emit or pass a QQuickEventPoint without losing the context of the event it came from. To this end, a pointerEvent() accessor is added, which simply does the static_cast for you. Change-Id: I71e57655cf1a0e7d741c4099c7eb9fc3a9a76446 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/quick/items/qquickevents_p_p.h')
-rw-r--r--src/quick/items/qquickevents_p_p.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index f9668eb434..ed75556d6a 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -238,6 +238,8 @@ private:
bool _accepted;
};
+class QQuickPointerEvent;
+
class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject
{
Q_OBJECT
@@ -248,11 +250,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
public:
- QQuickEventPoint() : QObject(), m_pointId(0), m_timestamp(0), m_pressTimestamp(0),
- m_state(Qt::TouchPointReleased), m_valid(false), m_accept(false)
- {
- Q_UNUSED(m_reserved);
- }
+ QQuickEventPoint(QQuickPointerEvent *parent);
void reset(Qt::TouchPointState state, QPointF scenePos, quint64 pointId, ulong timestamp)
{
@@ -269,6 +267,7 @@ public:
void invalidate() { m_valid = false; }
+ QQuickPointerEvent *pointerEvent() const;
QPointF scenePos() const { return m_scenePos; }
Qt::TouchPointState state() const { return m_state; }
quint64 pointId() const { return m_pointId; }
@@ -296,7 +295,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickEventTouchPoint : public QQuickEventPoint
Q_PROPERTY(QPointerUniqueId uniqueId READ uniqueId)
public:
- QQuickEventTouchPoint() : QQuickEventPoint(), m_rotation(0), m_pressure(0) { }
+ QQuickEventTouchPoint(QQuickPointerEvent *parent) : QQuickEventPoint(parent), m_rotation(0), m_pressure(0) { }
void reset(const QTouchEvent::TouchPoint &tp, ulong timestamp)
{