aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickevents_p_p.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-08-31 15:01:45 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2016-09-02 21:38:40 +0000
commit0dbb301e167292f728a845625556f2bef4699022 (patch)
tree7a527f05410363a84f99d1e41a22b35621144c49 /src/quick/items/qquickevents_p_p.h
parent856332456d9f289a05bc039cfa4e875f21441207 (diff)
QQuickPointerEvent and EventPoint: add localize(QQuickItem *)
During delivery we need to call QQuickItem::mapFromScene(point->scenePos()) so let's do it as early as possible and store the result right in the EventPoint. That way the pos() property can be made available, for the benefit of QML/JS signal handlers and also for C++ handlers. Change-Id: I2706ffd6bc51a449eeba64f69c9ffdfb913c5ca6 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'src/quick/items/qquickevents_p_p.h')
-rw-r--r--src/quick/items/qquickevents_p_p.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h
index 66393170ac..1c524e9e3b 100644
--- a/src/quick/items/qquickevents_p_p.h
+++ b/src/quick/items/qquickevents_p_p.h
@@ -250,6 +250,7 @@ private:
class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject
{
Q_OBJECT
+ Q_PROPERTY(QPointF pos READ pos)
Q_PROPERTY(QPointF scenePos READ scenePos)
Q_PROPERTY(QPointF scenePressPos READ scenePressPos)
Q_PROPERTY(QPointF sceneGrabPos READ sceneGrabPos)
@@ -273,10 +274,12 @@ public:
QQuickEventPoint(QQuickPointerEvent *parent);
void reset(Qt::TouchPointState state, const QPointF &scenePos, quint64 pointId, ulong timestamp, const QVector2D &velocity = QVector2D());
+ void localize(QQuickItem *target);
void invalidate() { m_valid = false; }
QQuickPointerEvent *pointerEvent() const;
+ QPointF pos() const { return m_pos; }
QPointF scenePos() const { return m_scenePos; }
QPointF scenePressPos() const { return m_scenePressPos; }
QPointF sceneGrabPos() const { return m_sceneGrabPos; }
@@ -297,6 +300,7 @@ public:
void setPointerHandlerGrabber(QQuickPointerHandler *grabber);
private:
+ QPointF m_pos;
QPointF m_scenePos;
QPointF m_scenePressPos;
QPointF m_sceneGrabPos;
@@ -365,6 +369,7 @@ public: // property accessors
public: // helpers for C++ only (during event delivery)
virtual QQuickPointerEvent *reset(QEvent *ev) = 0;
+ virtual void localize(QQuickItem *target) = 0;
virtual bool isPressEvent() const = 0;
virtual QQuickPointerMouseEvent *asPointerMouseEvent() { return nullptr; }
@@ -404,6 +409,7 @@ public:
: QQuickPointerEvent(parent), m_mousePoint(new QQuickEventPoint(this)) { }
QQuickPointerEvent *reset(QEvent *) override;
+ void localize(QQuickItem *target) override;
bool isPressEvent() const override;
QQuickPointerMouseEvent *asPointerMouseEvent() override { return this; }
const QQuickPointerMouseEvent *asPointerMouseEvent() const override { return this; }
@@ -433,6 +439,7 @@ public:
{ }
QQuickPointerEvent *reset(QEvent *) override;
+ void localize(QQuickItem *target) override;
bool isPressEvent() const override;
QQuickPointerTouchEvent *asPointerTouchEvent() override { return this; }
const QQuickPointerTouchEvent *asPointerTouchEvent() const override { return this; }