diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-07-23 13:56:26 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2020-09-18 20:56:25 +0200 |
commit | a97759a336c597327cb82eebc9f45c793aec32c9 (patch) | |
tree | 632bbee8568d38af56974e02df5810afcf48aedc /src/quick/handlers/qquickmultipointhandler_p.h | |
parent | 39f4d687fc37f48cbc181f42797c42be91b4a345 (diff) |
Remove QQuickPointerEvent etc.; deliver QPointerEvents directly
QEventPoint does not have an accessor to get the QPointerEvent that it
came from, because that's inconsistent with the idea that QPointerEvent
instances are temporary, stack-allocated and movable (the pointer would
often be wrong or null, therefore could not be relied upon).
So most functions that worked directly with QQuickEventPoint before
(which fortunately are still private API) now need to receive the
QPointerEvent too, which we choose to pass by pointer. QEventPoint is
always passed by reference (const where possible) to be consistent with
functions in QPointerEvent that take QEventPoint by reference.
QEventPoint::velocity() should be always in scene coordinates now, which
saves us the trouble of transforming it to each item's coordinate system
during delivery, but means that it will need to be done in handlers or
applications sometimes. If we were going to transform it, it would be
important to also store the sceneVelocity separately in QEventPoint
so that the transformation could be done repeatedly for different items.
Task-number: QTBUG-72173
Change-Id: I7ee164d2e6893c4e407fb7d579c75aa32843933a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickmultipointhandler_p.h')
-rw-r--r-- | src/quick/handlers/qquickmultipointhandler_p.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/quick/handlers/qquickmultipointhandler_p.h b/src/quick/handlers/qquickmultipointhandler_p.h index c0751aa5c5..01cd78f9db 100644 --- a/src/quick/handlers/qquickmultipointhandler_p.h +++ b/src/quick/handlers/qquickmultipointhandler_p.h @@ -91,22 +91,22 @@ protected: qreal angle; }; - bool wantsPointerEvent(QQuickPointerEvent *event) override; - void handlePointerEventImpl(QQuickPointerEvent *event) override; + bool wantsPointerEvent(QPointerEvent *event) override; + void handlePointerEventImpl(QPointerEvent *event) override; void onActiveChanged() override; - void onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabTransition transition, QQuickEventPoint *point) override; - QVector<QQuickHandlerPoint> ¤tPoints(); + void onGrabChanged(QQuickPointerHandler *grabber, QPointingDevice::GrabTransition transition, QPointerEvent *event, QEventPoint &point) override; + QList<QQuickHandlerPoint> ¤tPoints(); QQuickHandlerPoint &mutableCentroid(); - bool hasCurrentPoints(QQuickPointerEvent *event); - QVector<QQuickEventPoint *> eligiblePoints(QQuickPointerEvent *event); + bool hasCurrentPoints(QPointerEvent *event); + QVector<QEventPoint> eligiblePoints(QPointerEvent *event); qreal averageTouchPointDistance(const QPointF &ref); qreal averageStartingDistance(const QPointF &ref); qreal averageTouchPointAngle(const QPointF &ref); qreal averageStartingAngle(const QPointF &ref); QVector<PointData> angles(const QPointF &ref) const; static qreal averageAngleDelta(const QVector<PointData> &old, const QVector<PointData> &newAngles); - void acceptPoints(const QVector<QQuickEventPoint *> &points); - bool grabPoints(const QVector<QQuickEventPoint *> &points); + void acceptPoints(const QVector<QEventPoint> &points); + bool grabPoints(QPointerEvent *event, const QVector<QEventPoint> &points); void moveTarget(QPointF pos); Q_DECLARE_PRIVATE(QQuickMultiPointHandler) |