diff options
| author | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-05 08:28:15 +0200 |
|---|---|---|
| committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-08-16 09:32:54 +0000 |
| commit | 199692e06c839c64dd888a0a85c403e5c247c40e (patch) | |
| tree | fd4a3aa4e5b07bd6df36ad473730dc963b8eab22 | |
| parent | 54eab024611c6b9675ef6d48a15e7d69ed28df87 (diff) | |
QQuickPointerHandler: add eventPos() accessor
This is to compensate for the fact that the EventPoint does not store
the Item-localized position, only scenePos. Either it should store it
or we have to recalculate it in each Handler.
Change-Id: I5b02814d5fd7930bb32b547c1af00808b8e23b80
Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
| -rw-r--r-- | src/quick/handlers/qquickpointerhandler.cpp | 5 | ||||
| -rw-r--r-- | src/quick/handlers/qquickpointerhandler_p.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickpointerhandler.cpp b/src/quick/handlers/qquickpointerhandler.cpp index 9964d8f465..37238c4d51 100644 --- a/src/quick/handlers/qquickpointerhandler.cpp +++ b/src/quick/handlers/qquickpointerhandler.cpp @@ -71,6 +71,11 @@ void QQuickPointerHandler::setGrab(QQuickEventPoint *point, bool grab) point->setGrabber(nullptr); } +QPointF QQuickPointerHandler::eventPos(const QQuickEventPoint *point) const +{ + return (m_target ? m_target->mapFromScene(point->scenePos()) : point->scenePos()); +} + /*! \qmlproperty QQuickPointerHandler::enabled diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index b20f20d8f9..c6978b027c 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -87,6 +87,7 @@ protected: QQuickPointerEvent *currentEvent() { return m_currentEvent; } virtual void handlePointerEventImpl(QQuickPointerEvent *event); void setGrab(QQuickEventPoint *point, bool grab); + QPointF eventPos(const QQuickEventPoint *point) const; private: QQuickPointerEvent *m_currentEvent; |
