/src/qtbase/src/gui/kernel/qevent.h
Line | Count | Source |
1 | | // Copyright (C) 2020 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 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #ifndef QEVENT_H |
6 | | #define QEVENT_H |
7 | | |
8 | | #if 0 |
9 | | #pragma qt_class(QtEvents) |
10 | | #endif |
11 | | |
12 | | #include <QtGui/qtguiglobal.h> |
13 | | |
14 | | #include <QtCore/qcoreevent.h> |
15 | | #include <QtCore/qiodevice.h> |
16 | | #include <QtCore/qlist.h> |
17 | | #include <QtCore/qnamespace.h> |
18 | | #include <QtCore/qstring.h> |
19 | | #include <QtCore/qurl.h> |
20 | | #include <QtCore/qvariant.h> |
21 | | #include <QtGui/qeventpoint.h> |
22 | | #include <QtGui/qpointingdevice.h> |
23 | | #include <QtGui/qregion.h> |
24 | | #include <QtGui/qwindowdefs.h> |
25 | | |
26 | | #if QT_CONFIG(shortcut) |
27 | | # include <QtGui/qkeysequence.h> |
28 | | #endif |
29 | | |
30 | | class tst_QEvent; |
31 | | |
32 | | QT_BEGIN_NAMESPACE |
33 | | |
34 | | class QFile; |
35 | | class QAction; |
36 | | class QMouseEvent; |
37 | | template <typename T> class QPointer; |
38 | | class QPointerEvent; |
39 | | class QScreen; |
40 | | #if QT_CONFIG(shortcut) |
41 | | class QShortcut; |
42 | | #endif |
43 | | class QTabletEvent; |
44 | | class QTouchEvent; |
45 | | #if QT_CONFIG(gestures) |
46 | | class QGesture; |
47 | | #endif |
48 | | |
49 | | class Q_GUI_EXPORT QInputEvent : public QEvent |
50 | | { |
51 | | Q_DECL_EVENT_COMMON(QInputEvent) |
52 | | public: |
53 | | explicit QInputEvent(Type type, const QInputDevice *m_dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier); |
54 | | |
55 | 0 | const QInputDevice *device() const { return m_dev; } |
56 | 0 | QInputDevice::DeviceType deviceType() const { return m_dev ? m_dev->type() : QInputDevice::DeviceType::Unknown; } |
57 | 0 | inline Qt::KeyboardModifiers modifiers() const { return m_modState; } |
58 | 0 | inline void setModifiers(Qt::KeyboardModifiers modifiers) { m_modState = modifiers; } |
59 | 0 | inline quint64 timestamp() const { return m_timeStamp; } |
60 | 0 | virtual void setTimestamp(quint64 timestamp) { m_timeStamp = timestamp; } |
61 | | |
62 | | protected: |
63 | | QInputEvent(Type type, PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier); |
64 | | QInputEvent(Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier); |
65 | | |
66 | | const QInputDevice *m_dev = nullptr; |
67 | | quint64 m_timeStamp = 0; |
68 | | Qt::KeyboardModifiers m_modState = Qt::NoModifier; |
69 | | // fill up to the closest 8-byte aligned size: 48 |
70 | | quint32 m_reserved = 0; |
71 | | }; |
72 | | |
73 | | class Q_GUI_EXPORT QPointerEvent : public QInputEvent |
74 | | { |
75 | | Q_GADGET |
76 | | Q_DECL_EVENT_COMMON(QPointerEvent) |
77 | | public: |
78 | | explicit QPointerEvent(Type type, const QPointingDevice *dev, |
79 | | Qt::KeyboardModifiers modifiers = Qt::NoModifier, const QList<QEventPoint> &points = {}); |
80 | | |
81 | | const QPointingDevice *pointingDevice() const; |
82 | 0 | QPointingDevice::PointerType pointerType() const { |
83 | 0 | return pointingDevice() ? pointingDevice()->pointerType() : QPointingDevice::PointerType::Unknown; |
84 | 0 | } |
85 | | void setTimestamp(quint64 timestamp) override; |
86 | 0 | qsizetype pointCount() const { return m_points.size(); } |
87 | | QEventPoint &point(qsizetype i); |
88 | 0 | const QList<QEventPoint> &points() const { return m_points; } |
89 | | QEventPoint *pointById(int id); |
90 | | bool allPointsGrabbed() const; |
91 | 0 | virtual bool isBeginEvent() const { return false; } |
92 | 0 | virtual bool isUpdateEvent() const { return false; } |
93 | 0 | virtual bool isEndEvent() const { return false; } |
94 | | bool allPointsAccepted() const; |
95 | | virtual void setAccepted(bool accepted) override; |
96 | | QObject *exclusiveGrabber(const QEventPoint &point) const; |
97 | | void setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber); |
98 | | QList<QPointer <QObject>> passiveGrabbers(const QEventPoint &point) const; |
99 | | void clearPassiveGrabbers(const QEventPoint &point); |
100 | | bool addPassiveGrabber(const QEventPoint &point, QObject *grabber); |
101 | | bool removePassiveGrabber(const QEventPoint &point, QObject *grabber); |
102 | | |
103 | | protected: |
104 | | QPointerEvent(Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier); |
105 | | |
106 | | QList<QEventPoint> m_points; |
107 | | }; |
108 | | |
109 | | class Q_GUI_EXPORT QSinglePointEvent : public QPointerEvent |
110 | | { |
111 | | Q_GADGET |
112 | | Q_PROPERTY(QObject *exclusivePointGrabber READ exclusivePointGrabber |
113 | | WRITE setExclusivePointGrabber) |
114 | | |
115 | | Q_DECL_EVENT_COMMON(QSinglePointEvent) |
116 | | public: |
117 | 0 | inline Qt::MouseButton button() const { return m_button; } |
118 | 0 | inline Qt::MouseButtons buttons() const { return m_mouseState; } |
119 | | |
120 | | inline QPointF position() const |
121 | 0 | { Q_ASSERT(!m_points.isEmpty()); return m_points.first().position(); } |
122 | | inline QPointF scenePosition() const |
123 | 0 | { Q_ASSERT(!m_points.isEmpty()); return m_points.first().scenePosition(); } |
124 | | inline QPointF globalPosition() const |
125 | 0 | { Q_ASSERT(!m_points.isEmpty()); return m_points.first().globalPosition(); } |
126 | | |
127 | | bool isBeginEvent() const override; |
128 | | bool isUpdateEvent() const override; |
129 | | bool isEndEvent() const override; |
130 | | |
131 | | QObject *exclusivePointGrabber() const |
132 | 0 | { return QPointerEvent::exclusiveGrabber(points().first()); } |
133 | | void setExclusivePointGrabber(QObject *exclusiveGrabber) |
134 | 0 | { QPointerEvent::setExclusiveGrabber(points().first(), exclusiveGrabber); } |
135 | | |
136 | | protected: |
137 | | friend class ::tst_QEvent; |
138 | | friend class QMutableSinglePointEvent; |
139 | | QSinglePointEvent(Type type, const QPointingDevice *dev, const QEventPoint &point, |
140 | | Qt::MouseButton button, Qt::MouseButtons buttons, |
141 | | Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); |
142 | | QSinglePointEvent(Type type, const QPointingDevice *dev, const QPointF &localPos, |
143 | | const QPointF &scenePos, const QPointF &globalPos, |
144 | | Qt::MouseButton button, Qt::MouseButtons buttons, |
145 | | Qt::KeyboardModifiers modifiers, |
146 | | Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); |
147 | | |
148 | | Qt::MouseButton m_button = Qt::NoButton; |
149 | | Qt::MouseButtons m_mouseState = Qt::NoButton; |
150 | | Qt::MouseEventSource m_source; |
151 | | /* |
152 | | Fill up to the next 8-byte aligned size: 88 |
153 | | We have 32bits left, use some for QSinglePointEvent subclasses so that |
154 | | we don't end up with gaps. |
155 | | */ |
156 | | // split this in two quint16; with a quint32, MSVC would 32-bit align it |
157 | | quint16 m_reserved; |
158 | | quint16 m_reserved2 : 11; |
159 | | // for QMouseEvent |
160 | | quint16 m_doubleClick : 1; |
161 | | // for QWheelEvent |
162 | | quint16 m_phase : 3; |
163 | | quint16 m_invertedScrolling : 1; |
164 | | }; |
165 | | |
166 | | class Q_GUI_EXPORT QEnterEvent : public QSinglePointEvent |
167 | | { |
168 | | Q_DECL_EVENT_COMMON(QEnterEvent) |
169 | | public: |
170 | | QEnterEvent(const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, |
171 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
172 | | |
173 | | #if QT_DEPRECATED_SINCE(6, 0) |
174 | | #ifndef QT_NO_INTEGER_EVENT_COORDINATES |
175 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
176 | 0 | inline QPoint pos() const { return position().toPoint(); } |
177 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
178 | 0 | inline QPoint globalPos() const { return globalPosition().toPoint(); } |
179 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
180 | 0 | inline int x() const { return qRound(position().x()); } |
181 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
182 | 0 | inline int y() const { return qRound(position().y()); } |
183 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
184 | 0 | inline int globalX() const { return qRound(globalPosition().x()); } |
185 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
186 | 0 | inline int globalY() const { return qRound(globalPosition().y()); } |
187 | | #endif |
188 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
189 | 0 | QPointF localPos() const { return position(); } |
190 | | QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()") |
191 | 0 | QPointF windowPos() const { return scenePosition(); } |
192 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
193 | 0 | QPointF screenPos() const { return globalPosition(); } |
194 | | #endif // QT_DEPRECATED_SINCE(6, 0) |
195 | | }; |
196 | | |
197 | | class Q_GUI_EXPORT QMouseEvent : public QSinglePointEvent |
198 | | { |
199 | | Q_DECL_EVENT_COMMON(QMouseEvent) |
200 | | public: |
201 | | #if QT_DEPRECATED_SINCE(6, 4) |
202 | | QT_DEPRECATED_VERSION_X_6_4("Use another constructor") |
203 | | QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button, |
204 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, |
205 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
206 | | #endif |
207 | | QMouseEvent(Type type, const QPointF &localPos, const QPointF &globalPos, |
208 | | Qt::MouseButton button, Qt::MouseButtons buttons, |
209 | | Qt::KeyboardModifiers modifiers, |
210 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
211 | | QMouseEvent(Type type, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, |
212 | | Qt::MouseButton button, Qt::MouseButtons buttons, |
213 | | Qt::KeyboardModifiers modifiers, |
214 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
215 | | QMouseEvent(Type type, const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, |
216 | | Qt::MouseButton button, Qt::MouseButtons buttons, |
217 | | Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source, |
218 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
219 | | |
220 | | #ifndef QT_NO_INTEGER_EVENT_COORDINATES |
221 | 0 | inline QPoint pos() const { return position().toPoint(); } |
222 | | #endif |
223 | | #if QT_DEPRECATED_SINCE(6, 0) |
224 | | #ifndef QT_NO_INTEGER_EVENT_COORDINATES |
225 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
226 | 0 | inline QPoint globalPos() const { return globalPosition().toPoint(); } |
227 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
228 | 0 | inline int x() const { return qRound(position().x()); } |
229 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
230 | 0 | inline int y() const { return qRound(position().y()); } |
231 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
232 | 0 | inline int globalX() const { return qRound(globalPosition().x()); } |
233 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
234 | 0 | inline int globalY() const { return qRound(globalPosition().y()); } |
235 | | #endif // QT_NO_INTEGER_EVENT_COORDINATES |
236 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
237 | 0 | QPointF localPos() const { return position(); } |
238 | | QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()") |
239 | 0 | QPointF windowPos() const { return scenePosition(); } |
240 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
241 | 0 | QPointF screenPos() const { return globalPosition(); } |
242 | | #endif // QT_DEPRECATED_SINCE(6, 0) |
243 | | Qt::MouseEventSource source() const; |
244 | | Qt::MouseEventFlags flags() const; |
245 | | }; |
246 | | |
247 | | class Q_GUI_EXPORT QHoverEvent : public QSinglePointEvent |
248 | | { |
249 | | Q_DECL_EVENT_COMMON(QHoverEvent) |
250 | | public: |
251 | | QHoverEvent(Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos, |
252 | | Qt::KeyboardModifiers modifiers = Qt::NoModifier, |
253 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
254 | | #if QT_DEPRECATED_SINCE(6, 3) |
255 | | QT_DEPRECATED_VERSION_X_6_3("Use the other constructor") |
256 | | QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, |
257 | | Qt::KeyboardModifiers modifiers = Qt::NoModifier, |
258 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
259 | | #endif |
260 | | |
261 | | #if QT_DEPRECATED_SINCE(6, 0) |
262 | | #ifndef QT_NO_INTEGER_EVENT_COORDINATES |
263 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
264 | 0 | inline QPoint pos() const { return position().toPoint(); } |
265 | | #endif |
266 | | |
267 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
268 | 0 | inline QPointF posF() const { return position(); } |
269 | | #endif // QT_DEPRECATED_SINCE(6, 0) |
270 | | |
271 | 0 | bool isUpdateEvent() const override { return true; } |
272 | | |
273 | | // TODO deprecate when we figure out an actual replacement (point history?) |
274 | 0 | inline QPoint oldPos() const { return m_oldPos.toPoint(); } |
275 | 0 | inline QPointF oldPosF() const { return m_oldPos; } |
276 | | |
277 | | protected: |
278 | | QPointF m_oldPos; // TODO remove? |
279 | | }; |
280 | | |
281 | | #if QT_CONFIG(wheelevent) |
282 | | class Q_GUI_EXPORT QWheelEvent : public QSinglePointEvent |
283 | | { |
284 | | Q_GADGET |
285 | | Q_PROPERTY(const QPointingDevice *device READ pointingDevice) |
286 | | Q_PROPERTY(QPoint pixelDelta READ pixelDelta) |
287 | | Q_PROPERTY(QPoint angleDelta READ angleDelta) |
288 | | Q_PROPERTY(Qt::ScrollPhase phase READ phase) |
289 | | Q_PROPERTY(bool inverted READ inverted) |
290 | | |
291 | | Q_DECL_EVENT_COMMON(QWheelEvent) |
292 | | public: |
293 | | enum { DefaultDeltasPerStep = 120 }; |
294 | | |
295 | | QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, |
296 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, |
297 | | bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized, |
298 | | const QPointingDevice *device = QPointingDevice::primaryPointingDevice()); |
299 | | |
300 | 0 | inline QPoint pixelDelta() const { return m_pixelDelta; } |
301 | 0 | inline QPoint angleDelta() const { return m_angleDelta; } |
302 | | |
303 | 0 | inline Qt::ScrollPhase phase() const { return Qt::ScrollPhase(m_phase); } |
304 | 0 | inline bool inverted() const { return m_invertedScrolling; } |
305 | 0 | inline bool isInverted() const { return m_invertedScrolling; } |
306 | 0 | inline bool hasPixelDelta() const { return !m_pixelDelta.isNull(); } |
307 | | |
308 | | bool isBeginEvent() const override; |
309 | | bool isUpdateEvent() const override; |
310 | | bool isEndEvent() const override; |
311 | 0 | Qt::MouseEventSource source() const { return Qt::MouseEventSource(m_source); } |
312 | | |
313 | | protected: |
314 | | QPoint m_pixelDelta; |
315 | | QPoint m_angleDelta; |
316 | | }; |
317 | | #endif |
318 | | |
319 | | #if QT_CONFIG(tabletevent) |
320 | | class Q_GUI_EXPORT QTabletEvent : public QSinglePointEvent |
321 | | { |
322 | | Q_DECL_EVENT_COMMON(QTabletEvent) |
323 | | public: |
324 | | QTabletEvent(Type t, const QPointingDevice *device, |
325 | | const QPointF &pos, const QPointF &globalPos, |
326 | | qreal pressure, float xTilt, float yTilt, |
327 | | float tangentialPressure, qreal rotation, float z, |
328 | | Qt::KeyboardModifiers keyState, |
329 | | Qt::MouseButton button, Qt::MouseButtons buttons); |
330 | | |
331 | | #if QT_DEPRECATED_SINCE(6, 0) |
332 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
333 | 0 | inline QPoint pos() const { return position().toPoint(); } |
334 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
335 | 0 | inline QPoint globalPos() const { return globalPosition().toPoint(); } |
336 | | |
337 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
338 | 0 | inline const QPointF posF() const { return position(); } |
339 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
340 | 0 | inline const QPointF globalPosF() const { return globalPosition(); } |
341 | | QT_DEPRECATED_VERSION_X_6_0("Use position().x()") |
342 | 0 | inline int x() const { return qRound(position().x()); } |
343 | | QT_DEPRECATED_VERSION_X_6_0("Use position().y()") |
344 | 0 | inline int y() const { return qRound(position().y()); } |
345 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition().x()") |
346 | 0 | inline int globalX() const { return qRound(globalPosition().x()); } |
347 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition().y()") |
348 | 0 | inline int globalY() const { return qRound(globalPosition().y()); } |
349 | | QT_DEPRECATED_VERSION_X_6_0("use globalPosition().x()") |
350 | 0 | inline qreal hiResGlobalX() const { return globalPosition().x(); } |
351 | | QT_DEPRECATED_VERSION_X_6_0("use globalPosition().y()") |
352 | 0 | inline qreal hiResGlobalY() const { return globalPosition().y(); } |
353 | | QT_DEPRECATED_VERSION_X_6_0("use pointingDevice().uniqueId()") |
354 | 0 | inline qint64 uniqueId() const { return pointingDevice() ? pointingDevice()->uniqueId().numericId() : -1; } |
355 | | #endif |
356 | 0 | inline qreal pressure() const { Q_ASSERT(!points().isEmpty()); return points().first().pressure(); } |
357 | 0 | inline qreal rotation() const { Q_ASSERT(!points().isEmpty()); return points().first().rotation(); } |
358 | 0 | inline qreal z() const { return m_z; } |
359 | 0 | inline qreal tangentialPressure() const { return m_tangential; } |
360 | 0 | inline qreal xTilt() const { return m_xTilt; } |
361 | 0 | inline qreal yTilt() const { return m_yTilt; } |
362 | | |
363 | | protected: |
364 | | float m_tangential; |
365 | | float m_xTilt; |
366 | | float m_yTilt; |
367 | | float m_z; |
368 | | }; |
369 | | #endif // QT_CONFIG(tabletevent) |
370 | | |
371 | | #if QT_CONFIG(gestures) |
372 | | class Q_GUI_EXPORT QNativeGestureEvent : public QSinglePointEvent |
373 | | { |
374 | | Q_DECL_EVENT_COMMON(QNativeGestureEvent) |
375 | | public: |
376 | | #if QT_DEPRECATED_SINCE(6, 2) |
377 | | QT_DEPRECATED_VERSION_X_6_2("Use the other constructor") |
378 | | QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, const QPointF &localPos, const QPointF &scenePos, |
379 | | const QPointF &globalPos, qreal value, quint64 sequenceId, quint64 intArgument); |
380 | | #endif |
381 | | QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *dev, int fingerCount, |
382 | | const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, |
383 | | qreal value, const QPointF &delta, quint64 sequenceId = UINT64_MAX); |
384 | | |
385 | 0 | Qt::NativeGestureType gestureType() const { return m_gestureType; } |
386 | 0 | int fingerCount() const { return m_fingerCount; } |
387 | 0 | qreal value() const { return m_realValue; } |
388 | 0 | QPointF delta() const { |
389 | 0 | #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) |
390 | 0 | return m_delta.toPointF(); |
391 | 0 | #else |
392 | 0 | return m_delta; |
393 | 0 | #endif |
394 | 0 | } |
395 | | |
396 | | #if QT_DEPRECATED_SINCE(6, 0) |
397 | | #ifndef QT_NO_INTEGER_EVENT_COORDINATES |
398 | | QT_DEPRECATED_VERSION_X_6_0("Use position().toPoint()") |
399 | 0 | inline const QPoint pos() const { return position().toPoint(); } |
400 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition().toPoint()") |
401 | 0 | inline const QPoint globalPos() const { return globalPosition().toPoint(); } |
402 | | #endif |
403 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
404 | 0 | QPointF localPos() const { return position(); } |
405 | | QT_DEPRECATED_VERSION_X_6_0("Use scenePosition()") |
406 | 0 | QPointF windowPos() const { return scenePosition(); } |
407 | | QT_DEPRECATED_VERSION_X_6_0("Use globalPosition()") |
408 | 0 | QPointF screenPos() const { return globalPosition(); } |
409 | | #endif |
410 | | |
411 | | protected: |
412 | | quint64 m_sequenceId; |
413 | | #if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) |
414 | | QVector2D m_delta; |
415 | | #else |
416 | | QPointF m_delta; |
417 | | #endif |
418 | | qreal m_realValue; |
419 | | Qt::NativeGestureType m_gestureType; |
420 | | quint32 m_fingerCount : 4; |
421 | | quint32 m_reserved : 28; |
422 | | }; |
423 | | #endif // QT_CONFIG(gestures) |
424 | | |
425 | | class Q_GUI_EXPORT QKeyEvent : public QInputEvent |
426 | | { |
427 | | Q_DECL_EVENT_COMMON(QKeyEvent) |
428 | | public: |
429 | | QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), |
430 | | bool autorep = false, quint16 count = 1); |
431 | | QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, |
432 | | quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, |
433 | | const QString &text = QString(), bool autorep = false, quint16 count = 1, |
434 | | const QInputDevice *device = QInputDevice::primaryKeyboard()); |
435 | | |
436 | 0 | int key() const { return m_key; } |
437 | | #if QT_CONFIG(shortcut) |
438 | | bool matches(QKeySequence::StandardKey key) const; |
439 | | #endif |
440 | | Qt::KeyboardModifiers modifiers() const; |
441 | | QKeyCombination keyCombination() const |
442 | 0 | { |
443 | 0 | return QKeyCombination(modifiers(), Qt::Key(m_key)); |
444 | 0 | } |
445 | 0 | inline QString text() const { return m_text; } |
446 | 0 | inline bool isAutoRepeat() const { return m_autoRepeat; } |
447 | 0 | inline int count() const { return int(m_count); } |
448 | | |
449 | 0 | inline quint32 nativeScanCode() const { return m_scanCode; } |
450 | 0 | inline quint32 nativeVirtualKey() const { return m_virtualKey; } |
451 | 0 | inline quint32 nativeModifiers() const { return m_nativeModifiers; } |
452 | | |
453 | | #if QT_CONFIG(shortcut) |
454 | | friend inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key) |
455 | 0 | { return (e ? e->matches(key) : false); } |
456 | | friend inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e) |
457 | 0 | { return (e ? e->matches(key) : false); } |
458 | | #endif // QT_CONFIG(shortcut) |
459 | | |
460 | | protected: |
461 | | QString m_text; |
462 | | int m_key; |
463 | | quint32 m_scanCode; |
464 | | quint32 m_virtualKey; |
465 | | quint32 m_nativeModifiers; |
466 | | quint16 m_count : 15; |
467 | | quint16 m_autoRepeat : 1; |
468 | | }; |
469 | | |
470 | | |
471 | | class Q_GUI_EXPORT QFocusEvent : public QEvent |
472 | | { |
473 | | Q_DECL_EVENT_COMMON(QFocusEvent) |
474 | | public: |
475 | | explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason); |
476 | | |
477 | 0 | inline bool gotFocus() const { return type() == FocusIn; } |
478 | 0 | inline bool lostFocus() const { return type() == FocusOut; } |
479 | | |
480 | | Qt::FocusReason reason() const; |
481 | | |
482 | | private: |
483 | | Qt::FocusReason m_reason; |
484 | | }; |
485 | | |
486 | | |
487 | | class Q_GUI_EXPORT QPaintEvent : public QEvent |
488 | | { |
489 | | Q_DECL_EVENT_COMMON(QPaintEvent) |
490 | | public: |
491 | | explicit QPaintEvent(const QRegion& paintRegion); |
492 | | explicit QPaintEvent(const QRect &paintRect); |
493 | | |
494 | 0 | inline const QRect &rect() const { return m_rect; } |
495 | 0 | inline const QRegion ®ion() const { return m_region; } |
496 | | |
497 | | protected: |
498 | | QRect m_rect; |
499 | | QRegion m_region; |
500 | | bool m_erased; |
501 | | }; |
502 | | |
503 | | class Q_GUI_EXPORT QMoveEvent : public QEvent |
504 | | { |
505 | | Q_DECL_EVENT_COMMON(QMoveEvent) |
506 | | public: |
507 | | QMoveEvent(const QPoint &pos, const QPoint &oldPos); |
508 | | |
509 | 0 | inline const QPoint &pos() const { return m_pos; } |
510 | 0 | inline const QPoint &oldPos() const { return m_oldPos;} |
511 | | protected: |
512 | | QPoint m_pos, m_oldPos; |
513 | | friend class QApplication; |
514 | | friend class QApplicationPrivate; |
515 | | }; |
516 | | |
517 | | class Q_GUI_EXPORT QExposeEvent : public QEvent |
518 | | { |
519 | | Q_DECL_EVENT_COMMON(QExposeEvent) |
520 | | public: |
521 | | explicit QExposeEvent(const QRegion &m_region); |
522 | | |
523 | | #if QT_DEPRECATED_SINCE(6, 0) |
524 | | QT_DEPRECATED_VERSION_X_6_0("Handle QPaintEvent instead") |
525 | 0 | inline const QRegion ®ion() const { return m_region; } |
526 | | #endif |
527 | | |
528 | | protected: |
529 | | QRegion m_region; |
530 | | friend class QWidgetWindow; |
531 | | }; |
532 | | |
533 | | class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent |
534 | | { |
535 | | Q_DECL_EVENT_COMMON(QPlatformSurfaceEvent) |
536 | | public: |
537 | | enum SurfaceEventType { |
538 | | SurfaceCreated, |
539 | | SurfaceAboutToBeDestroyed |
540 | | }; |
541 | | |
542 | | explicit QPlatformSurfaceEvent(SurfaceEventType surfaceEventType); |
543 | | |
544 | 0 | inline SurfaceEventType surfaceEventType() const { return m_surfaceEventType; } |
545 | | |
546 | | protected: |
547 | | SurfaceEventType m_surfaceEventType; |
548 | | }; |
549 | | |
550 | | class Q_GUI_EXPORT QResizeEvent : public QEvent |
551 | | { |
552 | | Q_DECL_EVENT_COMMON(QResizeEvent) |
553 | | public: |
554 | | QResizeEvent(const QSize &size, const QSize &oldSize); |
555 | | |
556 | 0 | inline const QSize &size() const { return m_size; } |
557 | 0 | inline const QSize &oldSize()const { return m_oldSize;} |
558 | | protected: |
559 | | QSize m_size, m_oldSize; |
560 | | friend class QApplication; |
561 | | friend class QApplicationPrivate; |
562 | | }; |
563 | | |
564 | | |
565 | | class Q_GUI_EXPORT QCloseEvent : public QEvent |
566 | | { |
567 | | Q_DECL_EVENT_COMMON(QCloseEvent) |
568 | | public: |
569 | | QCloseEvent(); |
570 | | }; |
571 | | |
572 | | |
573 | | class Q_GUI_EXPORT QIconDragEvent : public QEvent |
574 | | { |
575 | | Q_DECL_EVENT_COMMON(QIconDragEvent) |
576 | | public: |
577 | | QIconDragEvent(); |
578 | | }; |
579 | | |
580 | | |
581 | | class Q_GUI_EXPORT QShowEvent : public QEvent |
582 | | { |
583 | | Q_DECL_EVENT_COMMON(QShowEvent) |
584 | | public: |
585 | | QShowEvent(); |
586 | | }; |
587 | | |
588 | | |
589 | | class Q_GUI_EXPORT QHideEvent : public QEvent |
590 | | { |
591 | | Q_DECL_EVENT_COMMON(QHideEvent) |
592 | | public: |
593 | | QHideEvent(); |
594 | | }; |
595 | | |
596 | | #ifndef QT_NO_CONTEXTMENU |
597 | | class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent |
598 | | { |
599 | | Q_DECL_EVENT_COMMON(QContextMenuEvent) |
600 | | public: |
601 | | enum Reason { Mouse, Keyboard, Other }; |
602 | | |
603 | | QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, |
604 | | Qt::KeyboardModifiers modifiers = Qt::NoModifier); |
605 | | #if QT_DEPRECATED_SINCE(6, 4) |
606 | | QT_DEPRECATED_VERSION_X_6_4("Use the other constructor") |
607 | | QContextMenuEvent(Reason reason, const QPoint &pos); |
608 | | #endif |
609 | | |
610 | 0 | inline int x() const { return m_pos.x(); } |
611 | 0 | inline int y() const { return m_pos.y(); } |
612 | 0 | inline int globalX() const { return m_globalPos.x(); } |
613 | 0 | inline int globalY() const { return m_globalPos.y(); } |
614 | | |
615 | 0 | inline const QPoint& pos() const { return m_pos; } |
616 | 0 | inline const QPoint& globalPos() const { return m_globalPos; } |
617 | | |
618 | 0 | inline Reason reason() const { return Reason(m_reason); } |
619 | | |
620 | | protected: |
621 | | QPoint m_pos; |
622 | | QPoint m_globalPos; |
623 | | uint m_reason : 8; |
624 | | }; |
625 | | #endif // QT_NO_CONTEXTMENU |
626 | | |
627 | | #ifndef QT_NO_INPUTMETHOD |
628 | | class Q_GUI_EXPORT QInputMethodEvent : public QEvent |
629 | | { |
630 | | Q_DECL_EVENT_COMMON(QInputMethodEvent) |
631 | | public: |
632 | | enum AttributeType { |
633 | | TextFormat, |
634 | | Cursor, |
635 | | Language, |
636 | | Ruby, |
637 | | Selection, |
638 | | MimeData |
639 | | }; |
640 | | class Attribute { |
641 | | public: |
642 | 0 | Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(std::move(val)) {} |
643 | 0 | Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {} |
644 | | |
645 | | AttributeType type; |
646 | | int start; |
647 | | int length; |
648 | | QVariant value; |
649 | | }; |
650 | | QInputMethodEvent(); |
651 | | QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes); |
652 | | |
653 | | void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); |
654 | 0 | inline const QList<Attribute> &attributes() const { return m_attributes; } |
655 | 0 | inline const QString &preeditString() const { return m_preedit; } |
656 | | |
657 | 0 | inline const QString &commitString() const { return m_commit; } |
658 | 0 | inline int replacementStart() const { return m_replacementStart; } |
659 | 0 | inline int replacementLength() const { return m_replacementLength; } |
660 | | |
661 | | inline friend bool operator==(const QInputMethodEvent::Attribute &lhs, |
662 | | const QInputMethodEvent::Attribute &rhs) |
663 | 0 | { |
664 | 0 | return lhs.type == rhs.type && lhs.start == rhs.start |
665 | 0 | && lhs.length == rhs.length && lhs.value == rhs.value; |
666 | 0 | } |
667 | | |
668 | | inline friend bool operator!=(const QInputMethodEvent::Attribute &lhs, |
669 | | const QInputMethodEvent::Attribute &rhs) |
670 | 0 | { |
671 | 0 | return !(lhs == rhs); |
672 | 0 | } |
673 | | |
674 | | private: |
675 | | QString m_preedit; |
676 | | QString m_commit; |
677 | | QList<Attribute> m_attributes; |
678 | | int m_replacementStart; |
679 | | int m_replacementLength; |
680 | | }; |
681 | | Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_RELOCATABLE_TYPE); |
682 | | |
683 | | class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent |
684 | | { |
685 | | Q_DECL_EVENT_COMMON(QInputMethodQueryEvent) |
686 | | public: |
687 | | explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries); |
688 | | |
689 | 0 | Qt::InputMethodQueries queries() const { return m_queries; } |
690 | | |
691 | | void setValue(Qt::InputMethodQuery query, const QVariant &value); |
692 | | QVariant value(Qt::InputMethodQuery query) const; |
693 | | private: |
694 | | Qt::InputMethodQueries m_queries; |
695 | | struct QueryPair { |
696 | | Qt::InputMethodQuery query; |
697 | | QVariant value; |
698 | | }; |
699 | | friend QTypeInfo<QueryPair>; |
700 | | QList<QueryPair> m_values; |
701 | | }; |
702 | | Q_DECLARE_TYPEINFO(QInputMethodQueryEvent::QueryPair, Q_RELOCATABLE_TYPE); |
703 | | |
704 | | #endif // QT_NO_INPUTMETHOD |
705 | | |
706 | | #if QT_CONFIG(draganddrop) |
707 | | |
708 | | class QMimeData; |
709 | | |
710 | | class Q_GUI_EXPORT QDropEvent : public QEvent |
711 | | { |
712 | | Q_DECL_EVENT_COMMON(QDropEvent) |
713 | | public: |
714 | | QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data, |
715 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop); |
716 | | |
717 | | #if QT_DEPRECATED_SINCE(6, 0) |
718 | | QT_DEPRECATED_VERSION_X_6_0("Use position().toPoint()") |
719 | 0 | inline QPoint pos() const { return position().toPoint(); } |
720 | | QT_DEPRECATED_VERSION_X_6_0("Use position()") |
721 | 0 | inline QPointF posF() const { return position(); } |
722 | | QT_DEPRECATED_VERSION_X_6_0("Use buttons()") |
723 | 0 | inline Qt::MouseButtons mouseButtons() const { return buttons(); } |
724 | | QT_DEPRECATED_VERSION_X_6_0("Use modifiers()") |
725 | 0 | inline Qt::KeyboardModifiers keyboardModifiers() const { return modifiers(); } |
726 | | #endif // QT_DEPRECATED_SINCE(6, 0) |
727 | | |
728 | 0 | QPointF position() const { return m_pos; } |
729 | 0 | inline Qt::MouseButtons buttons() const { return m_mouseState; } |
730 | 0 | inline Qt::KeyboardModifiers modifiers() const { return m_modState; } |
731 | | |
732 | 0 | inline Qt::DropActions possibleActions() const { return m_actions; } |
733 | 0 | inline Qt::DropAction proposedAction() const { return m_defaultAction; } |
734 | 0 | inline void acceptProposedAction() { m_dropAction = m_defaultAction; accept(); } |
735 | | |
736 | 0 | inline Qt::DropAction dropAction() const { return m_dropAction; } |
737 | | void setDropAction(Qt::DropAction action); |
738 | | |
739 | | QObject* source() const; |
740 | 0 | inline const QMimeData *mimeData() const { return m_data; } |
741 | | |
742 | | protected: |
743 | | friend class QApplication; |
744 | | QPointF m_pos; |
745 | | Qt::MouseButtons m_mouseState; |
746 | | Qt::KeyboardModifiers m_modState; |
747 | | Qt::DropActions m_actions; |
748 | | Qt::DropAction m_dropAction; |
749 | | Qt::DropAction m_defaultAction; |
750 | | const QMimeData *m_data; |
751 | | }; |
752 | | |
753 | | |
754 | | class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent |
755 | | { |
756 | | Q_DECL_EVENT_COMMON(QDragMoveEvent) |
757 | | public: |
758 | | #if QT_DEPRECATED_SINCE(6, 16) |
759 | | QT_DEPRECATED_VERSION_X_6_16("Use the constructor taking QPointF") |
760 | | QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, |
761 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove); |
762 | | #endif |
763 | | QDragMoveEvent(QPointF pos, Qt::DropActions actions, const QMimeData *data, |
764 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove); |
765 | | |
766 | 0 | inline QRect answerRect() const { return m_rect; } |
767 | | |
768 | 0 | inline void accept() { QDropEvent::accept(); } |
769 | 0 | inline void ignore() { QDropEvent::ignore(); } |
770 | | |
771 | 0 | inline void accept(const QRect & r) { accept(); m_rect = r; } |
772 | 0 | inline void ignore(const QRect & r) { ignore(); m_rect = r; } |
773 | | |
774 | | protected: |
775 | | QRect m_rect; |
776 | | }; |
777 | | |
778 | | |
779 | | class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent |
780 | | { |
781 | | Q_DECL_EVENT_COMMON(QDragEnterEvent) |
782 | | public: |
783 | | #if QT_DEPRECATED_SINCE(6, 16) |
784 | | QT_DEPRECATED_VERSION_X_6_16("Use the constructor taking QPointF") |
785 | | QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, |
786 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); |
787 | | #endif |
788 | | QDragEnterEvent(QPointF pos, Qt::DropActions actions, const QMimeData *data, |
789 | | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); |
790 | | }; |
791 | | |
792 | | |
793 | | class Q_GUI_EXPORT QDragLeaveEvent : public QEvent |
794 | | { |
795 | | Q_DECL_EVENT_COMMON(QDragLeaveEvent) |
796 | | public: |
797 | | QDragLeaveEvent(); |
798 | | }; |
799 | | #endif // QT_CONFIG(draganddrop) |
800 | | |
801 | | |
802 | | class Q_GUI_EXPORT QHelpEvent : public QEvent |
803 | | { |
804 | | Q_DECL_EVENT_COMMON(QHelpEvent) |
805 | | public: |
806 | | QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos); |
807 | | |
808 | 0 | inline int x() const { return m_pos.x(); } |
809 | 0 | inline int y() const { return m_pos.y(); } |
810 | 0 | inline int globalX() const { return m_globalPos.x(); } |
811 | 0 | inline int globalY() const { return m_globalPos.y(); } |
812 | | |
813 | 0 | inline const QPoint& pos() const { return m_pos; } |
814 | 0 | inline const QPoint& globalPos() const { return m_globalPos; } |
815 | | |
816 | | private: |
817 | | QPoint m_pos; |
818 | | QPoint m_globalPos; |
819 | | }; |
820 | | |
821 | | #ifndef QT_NO_STATUSTIP |
822 | | class Q_GUI_EXPORT QStatusTipEvent : public QEvent |
823 | | { |
824 | | Q_DECL_EVENT_COMMON(QStatusTipEvent) |
825 | | public: |
826 | | explicit QStatusTipEvent(const QString &tip); |
827 | | |
828 | 0 | inline QString tip() const { return m_tip; } |
829 | | private: |
830 | | QString m_tip; |
831 | | }; |
832 | | #endif |
833 | | |
834 | | #if QT_CONFIG(whatsthis) |
835 | | class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent |
836 | | { |
837 | | Q_DECL_EVENT_COMMON(QWhatsThisClickedEvent) |
838 | | public: |
839 | | explicit QWhatsThisClickedEvent(const QString &href); |
840 | | |
841 | 0 | inline QString href() const { return m_href; } |
842 | | private: |
843 | | QString m_href; |
844 | | }; |
845 | | #endif |
846 | | |
847 | | #if QT_CONFIG(action) |
848 | | class Q_GUI_EXPORT QActionEvent : public QEvent |
849 | | { |
850 | | Q_DECL_EVENT_COMMON(QActionEvent) |
851 | | public: |
852 | | QActionEvent(int type, QAction *action, QAction *before = nullptr); |
853 | | |
854 | 0 | inline QAction *action() const { return m_action; } |
855 | 0 | inline QAction *before() const { return m_before; } |
856 | | private: |
857 | | QAction *m_action; |
858 | | QAction *m_before; |
859 | | }; |
860 | | #endif // QT_CONFIG(action) |
861 | | |
862 | | class Q_GUI_EXPORT QFileOpenEvent : public QEvent |
863 | | { |
864 | | Q_DECL_EVENT_COMMON(QFileOpenEvent) |
865 | | public: |
866 | | explicit QFileOpenEvent(const QString &file); |
867 | | explicit QFileOpenEvent(const QUrl &url); |
868 | | |
869 | 0 | inline QString file() const { return m_file; } |
870 | 0 | QUrl url() const { return m_url; } |
871 | | #if QT_DEPRECATED_SINCE(6, 6) |
872 | | QT_DEPRECATED_VERSION_X_6_6("Interpret the string returned by file()") |
873 | | bool openFile(QFile &file, QIODevice::OpenMode flags) const; |
874 | | #endif |
875 | | private: |
876 | | QString m_file; |
877 | | QUrl m_url; |
878 | | }; |
879 | | |
880 | | #ifndef QT_NO_TOOLBAR |
881 | | class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent |
882 | | { |
883 | | Q_DECL_EVENT_COMMON(QToolBarChangeEvent) |
884 | | public: |
885 | | explicit QToolBarChangeEvent(bool t); |
886 | | |
887 | 0 | inline bool toggle() const { return m_toggle; } |
888 | | private: |
889 | | bool m_toggle; |
890 | | }; |
891 | | #endif |
892 | | |
893 | | #if QT_CONFIG(shortcut) |
894 | | class Q_GUI_EXPORT QShortcutEvent : public QEvent |
895 | | { |
896 | | Q_DECL_EVENT_COMMON(QShortcutEvent) |
897 | | public: |
898 | | // Note this is publicly deprecated, but should remain as internal constructor: |
899 | | QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false); |
900 | | QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut = nullptr, bool ambiguous = false); |
901 | | |
902 | 0 | inline const QKeySequence &key() const { return m_sequence; } |
903 | | // Note this is publicly deprecated, but should remain as internal getter: |
904 | 0 | inline int shortcutId() const { return m_shortcutId; } |
905 | 0 | inline bool isAmbiguous() const { return m_ambiguous; } |
906 | | protected: |
907 | | QKeySequence m_sequence; |
908 | | int m_shortcutId; |
909 | | bool m_ambiguous; |
910 | | }; |
911 | | #endif |
912 | | |
913 | | class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent |
914 | | { |
915 | | Q_DECL_EVENT_COMMON(QWindowStateChangeEvent) |
916 | | public: |
917 | | explicit QWindowStateChangeEvent(Qt::WindowStates oldState, bool isOverride = false); |
918 | | |
919 | 0 | inline Qt::WindowStates oldState() const { return m_oldStates; } |
920 | | bool isOverride() const; |
921 | | |
922 | | private: |
923 | | Qt::WindowStates m_oldStates; |
924 | | bool m_override; |
925 | | }; |
926 | | |
927 | | #ifndef QT_NO_DEBUG_STREAM |
928 | | // ### Qt 7: move this to Qt Core and add a hook to allow GUI events to be printed: QTBUG-127680 |
929 | | Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *); |
930 | | #endif |
931 | | |
932 | | class Q_GUI_EXPORT QTouchEvent : public QPointerEvent |
933 | | { |
934 | | Q_DECL_EVENT_COMMON(QTouchEvent) |
935 | | public: |
936 | | using TouchPoint = QEventPoint; // source compat |
937 | | |
938 | | explicit QTouchEvent(QEvent::Type eventType, |
939 | | const QPointingDevice *device = nullptr, |
940 | | Qt::KeyboardModifiers modifiers = Qt::NoModifier, |
941 | | const QList<QEventPoint> &touchPoints = {}); |
942 | | #if QT_DEPRECATED_SINCE(6, 0) |
943 | | QT_DEPRECATED_VERSION_X_6_0("Use another constructor") |
944 | | explicit QTouchEvent(QEvent::Type eventType, |
945 | | const QPointingDevice *device, |
946 | | Qt::KeyboardModifiers modifiers, |
947 | | QEventPoint::States touchPointStates, |
948 | | const QList<QEventPoint> &touchPoints = {}); |
949 | | #endif |
950 | | |
951 | 0 | inline QObject *target() const { return m_target; } |
952 | 0 | inline QEventPoint::States touchPointStates() const { return m_touchPointStates; } |
953 | | #if QT_DEPRECATED_SINCE(6, 0) |
954 | | QT_DEPRECATED_VERSION_X_6_0("Use points()") |
955 | 0 | const QList<QEventPoint> &touchPoints() const { return points(); } |
956 | | #endif |
957 | | bool isBeginEvent() const override; |
958 | | bool isUpdateEvent() const override; |
959 | | bool isEndEvent() const override; |
960 | | |
961 | | protected: |
962 | | friend class QMutableTouchEvent; |
963 | | QObject *m_target = nullptr; |
964 | | QEventPoint::States m_touchPointStates = QEventPoint::State::Unknown; |
965 | | quint32 m_reserved : 24; |
966 | | }; |
967 | | |
968 | | class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent |
969 | | { |
970 | | Q_DECL_EVENT_COMMON(QScrollPrepareEvent) |
971 | | public: |
972 | | explicit QScrollPrepareEvent(const QPointF &startPos); |
973 | | |
974 | 0 | QPointF startPos() const { return m_startPos; } |
975 | | |
976 | 0 | QSizeF viewportSize() const { return m_viewportSize; } |
977 | 0 | QRectF contentPosRange() const { return m_contentPosRange; } |
978 | 0 | QPointF contentPos() const { return m_contentPos; } |
979 | | |
980 | | void setViewportSize(const QSizeF &size); |
981 | | void setContentPosRange(const QRectF &rect); |
982 | | void setContentPos(const QPointF &pos); |
983 | | |
984 | | private: |
985 | | QRectF m_contentPosRange; |
986 | | QSizeF m_viewportSize; |
987 | | QPointF m_startPos; |
988 | | QPointF m_contentPos; |
989 | | }; |
990 | | |
991 | | |
992 | | class Q_GUI_EXPORT QScrollEvent : public QEvent |
993 | | { |
994 | | Q_DECL_EVENT_COMMON(QScrollEvent) |
995 | | public: |
996 | | enum ScrollState |
997 | | { |
998 | | ScrollStarted, |
999 | | ScrollUpdated, |
1000 | | ScrollFinished |
1001 | | }; |
1002 | | |
1003 | | QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState); |
1004 | | |
1005 | 0 | QPointF contentPos() const { return m_contentPos; } |
1006 | 0 | QPointF overshootDistance() const { return m_overshoot; } |
1007 | 0 | ScrollState scrollState() const { return m_state; } |
1008 | | |
1009 | | private: |
1010 | | QPointF m_contentPos; |
1011 | | QPointF m_overshoot; |
1012 | | QScrollEvent::ScrollState m_state; |
1013 | | }; |
1014 | | |
1015 | | class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent |
1016 | | { |
1017 | | Q_DECL_EVENT_COMMON(QScreenOrientationChangeEvent) |
1018 | | public: |
1019 | | QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation orientation); |
1020 | | |
1021 | 0 | QScreen *screen() const { return m_screen; } |
1022 | 0 | Qt::ScreenOrientation orientation() const { return m_orientation; } |
1023 | | |
1024 | | private: |
1025 | | QScreen *m_screen; |
1026 | | Qt::ScreenOrientation m_orientation; |
1027 | | }; |
1028 | | |
1029 | | class Q_GUI_EXPORT QApplicationStateChangeEvent : public QEvent |
1030 | | { |
1031 | | Q_DECL_EVENT_COMMON(QApplicationStateChangeEvent) |
1032 | | public: |
1033 | | explicit QApplicationStateChangeEvent(Qt::ApplicationState state); |
1034 | | |
1035 | 0 | Qt::ApplicationState applicationState() const { return m_applicationState; } |
1036 | | |
1037 | | private: |
1038 | | Qt::ApplicationState m_applicationState; |
1039 | | }; |
1040 | | |
1041 | | class Q_GUI_EXPORT QChildWindowEvent : public QEvent |
1042 | | { |
1043 | | Q_DECL_EVENT_COMMON(QChildWindowEvent) |
1044 | | public: |
1045 | | explicit QChildWindowEvent(Type type, QWindow *childWindow); |
1046 | 0 | QWindow *child() const { return c; } |
1047 | | |
1048 | | private: |
1049 | | QWindow *c; |
1050 | | }; |
1051 | | |
1052 | | QT_END_NAMESPACE |
1053 | | |
1054 | | #endif // QEVENT_H |