diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-06-11 07:38:46 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-07-19 10:56:06 +0000 |
commit | ca7cdd71ee33f0d77eb6bf1367d2532e26155cb2 (patch) | |
tree | af1b30bffea87bedb23e8cd795f23692f29b50a9 /src/quick/handlers/qquickdraghandler_p.h | |
parent | d310ca768bb5f45bae4fcec9a5d8151b6a366b8d (diff) |
Make DragHandler a MultiPointHandler
That is, minimumPointCount can now be set to a value > 1 to require
multiple fingers to do the dragging, or to track the displacement
of multiple fingers to adjust some value (such as the tilt of a map).
Task-number: QTBUG-68106
Change-Id: Ib35823e36deb81c8b277d3070fcc758c7c019564
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickdraghandler_p.h')
-rw-r--r-- | src/quick/handlers/qquickdraghandler_p.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h index 7ba1021924..ea49d59902 100644 --- a/src/quick/handlers/qquickdraghandler_p.h +++ b/src/quick/handlers/qquickdraghandler_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -51,12 +51,12 @@ // We mean it. // -#include "qquicksinglepointhandler_p.h" +#include "qquickmultipointhandler_p.h" #include "qquickdragaxis_p.h" QT_BEGIN_NAMESPACE -class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickSinglePointHandler +class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickMultiPointHandler { Q_OBJECT Q_PROPERTY(QQuickDragAxis * xAxis READ xAxis CONSTANT) @@ -67,7 +67,7 @@ public: explicit QQuickDragHandler(QObject *parent = nullptr); ~QQuickDragHandler(); - void handleEventPoint(QQuickEventPoint *point) override; + void handlePointerEventImpl(QQuickPointerEvent *event) override; QQuickDragAxis *xAxis() { return &m_xAxis; } QQuickDragAxis *yAxis() { return &m_yAxis; } @@ -82,18 +82,16 @@ Q_SIGNALS: void translationChanged(); protected: - bool wantsEventPoint(QQuickEventPoint *point) override; void onActiveChanged() override; void onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) override; private: void ungrab(); void enforceAxisConstraints(QPointF *localPos); - bool targetContains(QQuickEventPoint *point); - QPointF localTargetPosition(QQuickEventPoint *point); + bool targetContainsCentroid(); + QPointF targetCentroidPosition(); private: - QPointF m_pressScenePos; QPointF m_pressTargetPos; // We must also store the local targetPos, because we cannot deduce // the press target pos from the scene pos in case there was e.g a // flick in one of the ancestors during the drag. |