1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2018 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the QtQuick module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QQUICKHANDLERPOINT_H |
41 | #define QQUICKHANDLERPOINT_H |
42 | |
43 | // |
44 | // W A R N I N G |
45 | // ------------- |
46 | // |
47 | // This file is not part of the Qt API. It exists purely as an |
48 | // implementation detail. This header file may change from version to |
49 | // version without notice, or even be removed. |
50 | // |
51 | // We mean it. |
52 | // |
53 | |
54 | #include "qquickpointerdevicehandler_p.h" |
55 | |
56 | QT_BEGIN_NAMESPACE |
57 | |
58 | class QQuickMultiPointHandler; |
59 | class QQuickSinglePointHandler; |
60 | |
61 | class Q_QUICK_PRIVATE_EXPORT QQuickHandlerPoint { |
62 | Q_GADGET |
63 | Q_PROPERTY(int id READ id) |
64 | Q_PROPERTY(QPointingDeviceUniqueId uniqueId READ uniqueId) |
65 | Q_PROPERTY(QPointF position READ position) |
66 | Q_PROPERTY(QPointF scenePosition READ scenePosition) |
67 | Q_PROPERTY(QPointF pressPosition READ pressPosition) |
68 | Q_PROPERTY(QPointF scenePressPosition READ scenePressPosition) |
69 | Q_PROPERTY(QPointF sceneGrabPosition READ sceneGrabPosition) |
70 | Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons) |
71 | Q_PROPERTY(Qt::KeyboardModifiers modifiers READ modifiers) |
72 | Q_PROPERTY(QVector2D velocity READ velocity) |
73 | Q_PROPERTY(qreal rotation READ rotation) |
74 | Q_PROPERTY(qreal pressure READ pressure) |
75 | Q_PROPERTY(QSizeF ellipseDiameters READ ellipseDiameters) |
76 | |
77 | public: |
78 | QQuickHandlerPoint(); |
79 | |
80 | int id() const { return m_id; } |
81 | Qt::MouseButtons pressedButtons() const { return m_pressedButtons; } |
82 | Qt::KeyboardModifiers modifiers() const { return m_pressedModifiers; } |
83 | QPointF pressPosition() const { return m_pressPosition; } |
84 | QPointF scenePressPosition() const { return m_scenePressPosition; } |
85 | QPointF sceneGrabPosition() const { return m_sceneGrabPosition; } |
86 | QPointF position() const { return m_position; } |
87 | QPointF scenePosition() const { return m_scenePosition; } |
88 | QVector2D velocity() const { return m_velocity; } |
89 | qreal rotation() const { return m_rotation; } |
90 | qreal pressure() const { return m_pressure; } |
91 | QSizeF ellipseDiameters() const { return m_ellipseDiameters; } |
92 | QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; } |
93 | void localize(QQuickItem *item); |
94 | |
95 | void reset(); |
96 | void reset(const QQuickEventPoint *point); |
97 | void reset(const QVector<QQuickHandlerPoint> &points); |
98 | |
99 | private: |
100 | int m_id = 0; |
101 | QPointingDeviceUniqueId m_uniqueId; |
102 | Qt::MouseButtons m_pressedButtons = Qt::NoButton; |
103 | Qt::KeyboardModifiers m_pressedModifiers = Qt::NoModifier; |
104 | QPointF m_position; |
105 | QPointF m_scenePosition; |
106 | QPointF m_pressPosition; |
107 | QPointF m_scenePressPosition; |
108 | QPointF m_sceneGrabPosition; |
109 | QVector2D m_velocity; |
110 | qreal m_rotation = 0; |
111 | qreal m_pressure = 0; |
112 | QSizeF m_ellipseDiameters; |
113 | friend class QQuickMultiPointHandler; |
114 | friend class QQuickSinglePointHandler; |
115 | }; |
116 | |
117 | QT_END_NAMESPACE |
118 | |
119 | QML_DECLARE_TYPE(QQuickHandlerPoint) |
120 | |
121 | #endif // QQUICKHANDLERPOINT_H |
122 |