1 | // Copyright (C) 2018 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQUICKPOINTERHANDLER_P_H |
5 | #define QQUICKPOINTERHANDLER_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qevent.h" |
19 | |
20 | #include <QtCore/private/qobject_p.h> |
21 | #include <QtQuick/private/qquickevents_p_p.h> |
22 | #include <QtQuick/private/qquickpointerhandler_p.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class Q_QUICK_PRIVATE_EXPORT QQuickPointerHandlerPrivate : public QObjectPrivate |
27 | { |
28 | Q_DECLARE_PUBLIC(QQuickPointerHandler) |
29 | |
30 | public: |
31 | static QQuickPointerHandlerPrivate* get(QQuickPointerHandler *q) { return q->d_func(); } |
32 | static const QQuickPointerHandlerPrivate* get(const QQuickPointerHandler *q) { return q->d_func(); } |
33 | |
34 | QQuickPointerHandlerPrivate(); |
35 | |
36 | template<typename TEventPoint> |
37 | bool dragOverThreshold(qreal d, Qt::Axis axis, const TEventPoint &p) const; |
38 | |
39 | bool dragOverThreshold(QVector2D delta) const; |
40 | bool dragOverThreshold(const QEventPoint &point) const; |
41 | |
42 | virtual void onParentChanged(QQuickItem * /*oldParent*/, QQuickItem * /*newParent*/) {} |
43 | virtual void onEnabledChanged() {} |
44 | |
45 | static QVector<QObject *> &deviceDeliveryTargets(const QInputDevice *device); |
46 | |
47 | QPointerEvent *currentEvent = nullptr; |
48 | QQuickItem *target = nullptr; |
49 | qreal m_margin = 0; |
50 | quint64 lastEventTime = 0; |
51 | qint16 dragThreshold = -1; // -1 means use the platform default |
52 | uint8_t grabPermissions : 8; |
53 | Qt::CursorShape cursorShape : 6; |
54 | bool enabled : 1; |
55 | bool active : 1; |
56 | bool targetExplicitlySet : 1; |
57 | bool hadKeepMouseGrab : 1; // some handlers override target()->setKeepMouseGrab(); this remembers previous state |
58 | bool hadKeepTouchGrab : 1; // some handlers override target()->setKeepTouchGrab(); this remembers previous state |
59 | bool cursorSet : 1; |
60 | }; |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #endif // QQUICKPOINTERHANDLER_P_H |
65 | |