| 1 | /**************************************************************************** | 
|---|
| 2 | ** | 
|---|
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | 
|---|
| 4 | ** Contact: https://www.qt.io/licensing/ | 
|---|
| 5 | ** | 
|---|
| 6 | ** This file is part of the QtGui 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 QEVENT_H | 
|---|
| 41 | #define QEVENT_H | 
|---|
| 42 |  | 
|---|
| 43 | #include <QtGui/qtguiglobal.h> | 
|---|
| 44 | #include <QtGui/qwindowdefs.h> | 
|---|
| 45 | #include <QtGui/qregion.h> | 
|---|
| 46 | #include <QtCore/qnamespace.h> | 
|---|
| 47 | #include <QtCore/qstring.h> | 
|---|
| 48 | #include <QtGui/qkeysequence.h> | 
|---|
| 49 | #include <QtCore/qcoreevent.h> | 
|---|
| 50 | #include <QtCore/qvariant.h> | 
|---|
| 51 | #include <QtCore/qmap.h> // ### Qt 6: Remove | 
|---|
| 52 | #include <QtCore/qvector.h> | 
|---|
| 53 | #include <QtCore/qset.h> // ### Qt 6: Remove | 
|---|
| 54 | #include <QtCore/qurl.h> | 
|---|
| 55 | #include <QtCore/qfile.h> // ### Qt 6: Replace by <QtCore/qiodevice.h> and forward declare QFile | 
|---|
| 56 | #include <QtGui/qvector2d.h> | 
|---|
| 57 | #include <QtGui/qtouchdevice.h> // ### Qt 6: Replace by forward declaration | 
|---|
| 58 |  | 
|---|
| 59 | QT_BEGIN_NAMESPACE | 
|---|
| 60 |  | 
|---|
| 61 |  | 
|---|
| 62 | class QAction; | 
|---|
| 63 | #ifndef QT_NO_GESTURES | 
|---|
| 64 | class QGesture; | 
|---|
| 65 | #endif | 
|---|
| 66 | class QScreen; | 
|---|
| 67 |  | 
|---|
| 68 | class Q_GUI_EXPORT QInputEvent : public QEvent | 
|---|
| 69 | { | 
|---|
| 70 | public: | 
|---|
| 71 | explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier); | 
|---|
| 72 | ~QInputEvent(); | 
|---|
| 73 | inline Qt::KeyboardModifiers modifiers() const { return modState; } | 
|---|
| 74 | inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; } | 
|---|
| 75 | inline ulong timestamp() const { return ts; } | 
|---|
| 76 | inline void setTimestamp(ulong atimestamp) { ts = atimestamp; } | 
|---|
| 77 | protected: | 
|---|
| 78 | Qt::KeyboardModifiers modState; | 
|---|
| 79 | ulong ts; | 
|---|
| 80 | }; | 
|---|
| 81 |  | 
|---|
| 82 | class Q_GUI_EXPORT QEnterEvent : public QEvent | 
|---|
| 83 | { | 
|---|
| 84 | public: | 
|---|
| 85 | QEnterEvent(const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos); | 
|---|
| 86 | ~QEnterEvent(); | 
|---|
| 87 |  | 
|---|
| 88 | #ifndef QT_NO_INTEGER_EVENT_COORDINATES | 
|---|
| 89 | inline QPoint pos() const { return l.toPoint(); } | 
|---|
| 90 | inline QPoint globalPos() const { return s.toPoint(); } | 
|---|
| 91 | inline int x() const { return qRound(l.x()); } | 
|---|
| 92 | inline int y() const { return qRound(l.y()); } | 
|---|
| 93 | inline int globalX() const { return qRound(s.x()); } | 
|---|
| 94 | inline int globalY() const { return qRound(s.y()); } | 
|---|
| 95 | #endif | 
|---|
| 96 | const QPointF &localPos() const { return l; } | 
|---|
| 97 | const QPointF &windowPos() const { return w; } | 
|---|
| 98 | const QPointF &screenPos() const { return s; } | 
|---|
| 99 |  | 
|---|
| 100 | protected: | 
|---|
| 101 | QPointF l, w, s; | 
|---|
| 102 | }; | 
|---|
| 103 |  | 
|---|
| 104 | class Q_GUI_EXPORT QMouseEvent : public QInputEvent | 
|---|
| 105 | { | 
|---|
| 106 | public: | 
|---|
| 107 | QMouseEvent(Type type, const QPointF &localPos, Qt::MouseButton button, | 
|---|
| 108 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); | 
|---|
| 109 | QMouseEvent(Type type, const QPointF &localPos, const QPointF &screenPos, | 
|---|
| 110 | Qt::MouseButton button, Qt::MouseButtons buttons, | 
|---|
| 111 | Qt::KeyboardModifiers modifiers); | 
|---|
| 112 | QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, | 
|---|
| 113 | Qt::MouseButton button, Qt::MouseButtons buttons, | 
|---|
| 114 | Qt::KeyboardModifiers modifiers); | 
|---|
| 115 | QMouseEvent(Type type, const QPointF &localPos, const QPointF &windowPos, const QPointF &screenPos, | 
|---|
| 116 | Qt::MouseButton button, Qt::MouseButtons buttons, | 
|---|
| 117 | Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source); | 
|---|
| 118 | ~QMouseEvent(); | 
|---|
| 119 |  | 
|---|
| 120 | #ifndef QT_NO_INTEGER_EVENT_COORDINATES | 
|---|
| 121 | inline QPoint pos() const { return l.toPoint(); } | 
|---|
| 122 | inline QPoint globalPos() const { return s.toPoint(); } | 
|---|
| 123 | inline int x() const { return qRound(l.x()); } | 
|---|
| 124 | inline int y() const { return qRound(l.y()); } | 
|---|
| 125 | inline int globalX() const { return qRound(s.x()); } | 
|---|
| 126 | inline int globalY() const { return qRound(s.y()); } | 
|---|
| 127 | #endif | 
|---|
| 128 | const QPointF &localPos() const { return l; } | 
|---|
| 129 | const QPointF &windowPos() const { return w; } | 
|---|
| 130 | const QPointF &screenPos() const { return s; } | 
|---|
| 131 |  | 
|---|
| 132 | inline Qt::MouseButton button() const { return b; } | 
|---|
| 133 | inline Qt::MouseButtons buttons() const { return mouseState; } | 
|---|
| 134 |  | 
|---|
| 135 | inline void setLocalPos(const QPointF &localPosition) { l = localPosition; } | 
|---|
| 136 |  | 
|---|
| 137 | #if QT_DEPRECATED_SINCE(5, 0) | 
|---|
| 138 | QT_DEPRECATED inline QPointF posF() const { return l; } | 
|---|
| 139 | #endif | 
|---|
| 140 |  | 
|---|
| 141 | Qt::MouseEventSource source() const; | 
|---|
| 142 | Qt::MouseEventFlags flags() const; | 
|---|
| 143 |  | 
|---|
| 144 | protected: | 
|---|
| 145 | QPointF l, w, s; | 
|---|
| 146 | Qt::MouseButton b; | 
|---|
| 147 | Qt::MouseButtons mouseState; | 
|---|
| 148 | int caps; | 
|---|
| 149 | QVector2D velocity; | 
|---|
| 150 |  | 
|---|
| 151 | friend class QGuiApplicationPrivate; | 
|---|
| 152 | }; | 
|---|
| 153 |  | 
|---|
| 154 | class Q_GUI_EXPORT QHoverEvent : public QInputEvent | 
|---|
| 155 | { | 
|---|
| 156 | public: | 
|---|
| 157 | QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers = Qt::NoModifier); | 
|---|
| 158 | ~QHoverEvent(); | 
|---|
| 159 |  | 
|---|
| 160 | #ifndef QT_NO_INTEGER_EVENT_COORDINATES | 
|---|
| 161 | inline QPoint pos() const { return p.toPoint(); } | 
|---|
| 162 | inline QPoint oldPos() const { return op.toPoint(); } | 
|---|
| 163 | #endif | 
|---|
| 164 |  | 
|---|
| 165 | inline const QPointF &posF() const { return p; } | 
|---|
| 166 | inline const QPointF &oldPosF() const { return op; } | 
|---|
| 167 |  | 
|---|
| 168 | protected: | 
|---|
| 169 | QPointF p, op; | 
|---|
| 170 | }; | 
|---|
| 171 |  | 
|---|
| 172 | #if QT_CONFIG(wheelevent) | 
|---|
| 173 | class Q_GUI_EXPORT QWheelEvent : public QInputEvent | 
|---|
| 174 | { | 
|---|
| 175 | public: | 
|---|
| 176 | enum { DefaultDeltasPerStep = 120 }; | 
|---|
| 177 |  | 
|---|
| 178 | #if QT_DEPRECATED_SINCE(5, 15) | 
|---|
| 179 | // Actually deprecated since 5.0, in docs | 
|---|
| 180 | QT_DEPRECATED_VERSION_X_5_15( "Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") | 
|---|
| 181 | QWheelEvent(const QPointF &pos, int delta, | 
|---|
| 182 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, | 
|---|
| 183 | Qt::Orientation orient = Qt::Vertical); | 
|---|
| 184 | // Actually deprecated since 5.0, in docs | 
|---|
| 185 | QT_DEPRECATED_VERSION_X_5_15( "Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") | 
|---|
| 186 | QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta, | 
|---|
| 187 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, | 
|---|
| 188 | Qt::Orientation orient = Qt::Vertical); | 
|---|
| 189 | QT_DEPRECATED_VERSION_X_5_15( "Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") | 
|---|
| 190 | QWheelEvent(const QPointF &pos, const QPointF& globalPos, | 
|---|
| 191 | QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, | 
|---|
| 192 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); | 
|---|
| 193 | QT_DEPRECATED_VERSION_X_5_15( "Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") | 
|---|
| 194 | QWheelEvent(const QPointF &pos, const QPointF& globalPos, | 
|---|
| 195 | QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation, | 
|---|
| 196 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase); | 
|---|
| 197 | QT_DEPRECATED_VERSION_X_5_15( "Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") | 
|---|
| 198 | QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, | 
|---|
| 199 | int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, | 
|---|
| 200 | Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source); | 
|---|
| 201 | QT_DEPRECATED_VERSION_X_5_15( "Use the last QWheelEvent constructor taking pixelDelta, angleDelta, phase, and inverted") | 
|---|
| 202 | QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta, | 
|---|
| 203 | int qt4Delta, Qt::Orientation qt4Orientation, Qt::MouseButtons buttons, | 
|---|
| 204 | Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted); | 
|---|
| 205 | #endif | 
|---|
| 206 |  | 
|---|
| 207 | QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta, | 
|---|
| 208 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, | 
|---|
| 209 | bool inverted, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized); | 
|---|
| 210 | ~QWheelEvent(); | 
|---|
| 211 |  | 
|---|
| 212 |  | 
|---|
| 213 | inline QPoint pixelDelta() const { return pixelD; } | 
|---|
| 214 | inline QPoint angleDelta() const { return angleD; } | 
|---|
| 215 |  | 
|---|
| 216 | #if QT_DEPRECATED_SINCE(5, 15) | 
|---|
| 217 | // Actually deprecated since 5.0, in docs | 
|---|
| 218 | QT_DEPRECATED_VERSION_X_5_15( "Use angleDelta()") | 
|---|
| 219 | inline int delta() const  { return qt4D; } | 
|---|
| 220 | // Actually deprecated since 5.0, in docs | 
|---|
| 221 | QT_DEPRECATED_VERSION_X_5_15( "Use angleDelta()") | 
|---|
| 222 | inline Qt::Orientation orientation() const { return qt4O; } | 
|---|
| 223 | #ifndef QT_NO_INTEGER_EVENT_COORDINATES | 
|---|
| 224 | QT_DEPRECATED_VERSION_X_5_15( "Use position()") | 
|---|
| 225 | inline QPoint pos() const { return p.toPoint(); } | 
|---|
| 226 | QT_DEPRECATED_VERSION_X_5_15( "Use globalPosition()") | 
|---|
| 227 | inline QPoint globalPos()   const { return g.toPoint(); } | 
|---|
| 228 | QT_DEPRECATED_VERSION_X_5_15( "Use position()") | 
|---|
| 229 | inline int x() const { return int(p.x()); } | 
|---|
| 230 | QT_DEPRECATED_VERSION_X_5_15( "Use position()") | 
|---|
| 231 | inline int y() const { return int(p.y()); } | 
|---|
| 232 | QT_DEPRECATED_VERSION_X_5_15( "Use globalPosition()") | 
|---|
| 233 | inline int globalX() const { return int(g.x()); } | 
|---|
| 234 | QT_DEPRECATED_VERSION_X_5_15( "Use globalPosition()") | 
|---|
| 235 | inline int globalY() const { return int(g.y()); } | 
|---|
| 236 | #endif | 
|---|
| 237 | QT_DEPRECATED_VERSION_X_5_15( "Use position()") | 
|---|
| 238 | inline const QPointF &posF() const { return p; } | 
|---|
| 239 | QT_DEPRECATED_VERSION_X_5_15( "Use globalPosition()") | 
|---|
| 240 | inline const QPointF &globalPosF()   const { return g; } | 
|---|
| 241 | #endif // QT_DEPRECATED_SINCE(5, 15) | 
|---|
| 242 |  | 
|---|
| 243 | inline QPointF position() const { return p; } | 
|---|
| 244 | inline QPointF globalPosition() const { return g; } | 
|---|
| 245 |  | 
|---|
| 246 | inline Qt::MouseButtons buttons() const { return mouseState; } | 
|---|
| 247 |  | 
|---|
| 248 | inline Qt::ScrollPhase phase() const { return Qt::ScrollPhase(ph); } | 
|---|
| 249 | inline bool inverted() const { return invertedScrolling; } | 
|---|
| 250 |  | 
|---|
| 251 | Qt::MouseEventSource source() const { return Qt::MouseEventSource(src); } | 
|---|
| 252 |  | 
|---|
| 253 | protected: | 
|---|
| 254 | QPointF p; | 
|---|
| 255 | QPointF g; | 
|---|
| 256 | QPoint pixelD; | 
|---|
| 257 | QPoint angleD; | 
|---|
| 258 | int qt4D = 0; | 
|---|
| 259 | Qt::Orientation qt4O = Qt::Vertical; | 
|---|
| 260 | Qt::MouseButtons mouseState = Qt::NoButton; | 
|---|
| 261 | uint _unused_ : 2; // Kept for binary compatibility | 
|---|
| 262 | uint src: 2; | 
|---|
| 263 | bool invertedScrolling : 1; | 
|---|
| 264 | uint ph : 3; | 
|---|
| 265 | int reserved : 24; | 
|---|
| 266 |  | 
|---|
| 267 | friend class QApplication; | 
|---|
| 268 | }; | 
|---|
| 269 | #endif | 
|---|
| 270 |  | 
|---|
| 271 | #if QT_CONFIG(tabletevent) | 
|---|
| 272 | class Q_GUI_EXPORT QTabletEvent : public QInputEvent | 
|---|
| 273 | { | 
|---|
| 274 | Q_GADGET | 
|---|
| 275 | public: | 
|---|
| 276 | enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, | 
|---|
| 277 | XFreeEraser /*internal*/, RotationStylus }; | 
|---|
| 278 | Q_ENUM(TabletDevice) | 
|---|
| 279 | enum PointerType { UnknownPointer, Pen, Cursor, Eraser }; | 
|---|
| 280 | Q_ENUM(PointerType) | 
|---|
| 281 |  | 
|---|
| 282 | #if QT_DEPRECATED_SINCE(5, 15) | 
|---|
| 283 | // Actually deprecated since 5.4, in docs | 
|---|
| 284 | QT_DEPRECATED_VERSION_X_5_15( "Use the other QTabletEvent constructor") | 
|---|
| 285 | QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos, | 
|---|
| 286 | int device, int pointerType, qreal pressure, int xTilt, int yTilt, | 
|---|
| 287 | qreal tangentialPressure, qreal rotation, int z, | 
|---|
| 288 | Qt::KeyboardModifiers keyState, qint64 uniqueID); // ### remove in Qt 6 | 
|---|
| 289 | #endif | 
|---|
| 290 | QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos, | 
|---|
| 291 | int device, int pointerType, qreal pressure, int xTilt, int yTilt, | 
|---|
| 292 | qreal tangentialPressure, qreal rotation, int z, | 
|---|
| 293 | Qt::KeyboardModifiers keyState, qint64 uniqueID, | 
|---|
| 294 | Qt::MouseButton button, Qt::MouseButtons buttons); | 
|---|
| 295 | ~QTabletEvent(); | 
|---|
| 296 |  | 
|---|
| 297 | inline QPoint pos() const { return mPos.toPoint(); } | 
|---|
| 298 | inline QPoint globalPos() const { return mGPos.toPoint(); } | 
|---|
| 299 | #if QT_DEPRECATED_SINCE(5,0) | 
|---|
| 300 | QT_DEPRECATED inline const QPointF &hiResGlobalPos() const { return mPos; } | 
|---|
| 301 | #endif | 
|---|
| 302 |  | 
|---|
| 303 | inline const QPointF &posF() const { return mPos; } | 
|---|
| 304 | inline const QPointF &globalPosF() const { return mGPos; } | 
|---|
| 305 |  | 
|---|
| 306 | inline int x() const { return qRound(mPos.x()); } | 
|---|
| 307 | inline int y() const { return qRound(mPos.y()); } | 
|---|
| 308 | inline int globalX() const { return qRound(mGPos.x()); } | 
|---|
| 309 | inline int globalY() const { return qRound(mGPos.y()); } | 
|---|
| 310 | #if QT_DEPRECATED_SINCE(5, 15) | 
|---|
| 311 | QT_DEPRECATED_VERSION_X_5_15( "use globalPosF().x()") | 
|---|
| 312 | inline qreal hiResGlobalX() const { return mGPos.x(); } | 
|---|
| 313 | QT_DEPRECATED_VERSION_X_5_15( "use globalPosF().y()") | 
|---|
| 314 | inline qreal hiResGlobalY() const { return mGPos.y(); } | 
|---|
| 315 | QT_DEPRECATED_VERSION_X_5_15( "Use deviceType()") | 
|---|
| 316 | inline TabletDevice device() const { return TabletDevice(mDev); } | 
|---|
| 317 | #endif | 
|---|
| 318 | inline TabletDevice deviceType() const { return TabletDevice(mDev); } | 
|---|
| 319 | inline PointerType pointerType() const { return PointerType(mPointerType); } | 
|---|
| 320 | inline qint64 uniqueId() const { return mUnique; } | 
|---|
| 321 | inline qreal pressure() const { return mPress; } | 
|---|
| 322 | inline int z() const { return mZ; } | 
|---|
| 323 | inline qreal tangentialPressure() const { return mTangential; } | 
|---|
| 324 | inline qreal rotation() const { return mRot; } | 
|---|
| 325 | inline int xTilt() const { return mXT; } | 
|---|
| 326 | inline int yTilt() const { return mYT; } | 
|---|
| 327 | Qt::MouseButton button() const; | 
|---|
| 328 | Qt::MouseButtons buttons() const; | 
|---|
| 329 |  | 
|---|
| 330 | protected: | 
|---|
| 331 | QPointF mPos, mGPos; | 
|---|
| 332 | int mDev, mPointerType, mXT, mYT, mZ; | 
|---|
| 333 | qreal mPress, mTangential, mRot; | 
|---|
| 334 | qint64 mUnique; | 
|---|
| 335 |  | 
|---|
| 336 | // QTabletEventPrivate for extra storage. | 
|---|
| 337 | // ### Qt 6: QPointingEvent will have Buttons, QTabletEvent will inherit | 
|---|
| 338 | void *; | 
|---|
| 339 | }; | 
|---|
| 340 | #endif // QT_CONFIG(tabletevent) | 
|---|
| 341 |  | 
|---|
| 342 | #ifndef QT_NO_GESTURES | 
|---|
| 343 | class Q_GUI_EXPORT QNativeGestureEvent : public QInputEvent | 
|---|
| 344 | { | 
|---|
| 345 | public: | 
|---|
| 346 | #if QT_DEPRECATED_SINCE(5, 10) | 
|---|
| 347 | QT_DEPRECATED QNativeGestureEvent(Qt::NativeGestureType type, const QPointF &localPos, const QPointF &windowPos, | 
|---|
| 348 | const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); | 
|---|
| 349 | #endif | 
|---|
| 350 | QNativeGestureEvent(Qt::NativeGestureType type, const QTouchDevice *dev, const QPointF &localPos, const QPointF &windowPos, | 
|---|
| 351 | const QPointF &screenPos, qreal value, ulong sequenceId, quint64 intArgument); | 
|---|
| 352 | ~QNativeGestureEvent(); | 
|---|
| 353 | Qt::NativeGestureType gestureType() const { return mGestureType; } | 
|---|
| 354 | qreal value() const { return mRealValue; } | 
|---|
| 355 |  | 
|---|
| 356 | #ifndef QT_NO_INTEGER_EVENT_COORDINATES | 
|---|
| 357 | inline const QPoint pos() const { return mLocalPos.toPoint(); } | 
|---|
| 358 | inline const QPoint globalPos() const { return mScreenPos.toPoint(); } | 
|---|
| 359 | #endif | 
|---|
| 360 | const QPointF &localPos() const { return mLocalPos; } | 
|---|
| 361 | const QPointF &windowPos() const { return mWindowPos; } | 
|---|
| 362 | const QPointF &screenPos() const { return mScreenPos; } | 
|---|
| 363 |  | 
|---|
| 364 | const QTouchDevice *device() const; | 
|---|
| 365 |  | 
|---|
| 366 | protected: | 
|---|
| 367 | Qt::NativeGestureType mGestureType; | 
|---|
| 368 | QPointF mLocalPos; | 
|---|
| 369 | QPointF mWindowPos; | 
|---|
| 370 | QPointF mScreenPos; | 
|---|
| 371 | qreal mRealValue; | 
|---|
| 372 | ulong mSequenceId; | 
|---|
| 373 | quint64 mIntValue; | 
|---|
| 374 | }; | 
|---|
| 375 | #endif // QT_NO_GESTURES | 
|---|
| 376 |  | 
|---|
| 377 | class Q_GUI_EXPORT QKeyEvent : public QInputEvent | 
|---|
| 378 | { | 
|---|
| 379 | public: | 
|---|
| 380 | QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(), | 
|---|
| 381 | bool autorep = false, ushort count = 1); | 
|---|
| 382 | QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, | 
|---|
| 383 | quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, | 
|---|
| 384 | const QString &text = QString(), bool autorep = false, ushort count = 1); | 
|---|
| 385 | ~QKeyEvent(); | 
|---|
| 386 |  | 
|---|
| 387 | int key() const { return k; } | 
|---|
| 388 | #ifndef QT_NO_SHORTCUT | 
|---|
| 389 | bool matches(QKeySequence::StandardKey key) const; | 
|---|
| 390 | #endif | 
|---|
| 391 | Qt::KeyboardModifiers modifiers() const; | 
|---|
| 392 | inline QString text() const { return txt; } | 
|---|
| 393 | inline bool isAutoRepeat() const { return autor; } | 
|---|
| 394 | inline int count() const { return int(c); } | 
|---|
| 395 |  | 
|---|
| 396 | inline quint32 nativeScanCode() const { return nScanCode; } | 
|---|
| 397 | inline quint32 nativeVirtualKey() const { return nVirtualKey; } | 
|---|
| 398 | inline quint32 nativeModifiers() const { return nModifiers; } | 
|---|
| 399 |  | 
|---|
| 400 | // Functions for the extended key event information | 
|---|
| 401 | #if QT_DEPRECATED_SINCE(5, 0) | 
|---|
| 402 | static inline QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, | 
|---|
| 403 | quint32 nativeScanCode, quint32 nativeVirtualKey, | 
|---|
| 404 | quint32 nativeModifiers, | 
|---|
| 405 | const QString& text = QString(), bool autorep = false, | 
|---|
| 406 | ushort count = 1) | 
|---|
| 407 | { | 
|---|
| 408 | return new QKeyEvent(type, key, modifiers, | 
|---|
| 409 | nativeScanCode, nativeVirtualKey, nativeModifiers, | 
|---|
| 410 | text, autorep, count); | 
|---|
| 411 | } | 
|---|
| 412 |  | 
|---|
| 413 | inline bool hasExtendedInfo() const { return true; } | 
|---|
| 414 | #endif | 
|---|
| 415 |  | 
|---|
| 416 | protected: | 
|---|
| 417 | QString txt; | 
|---|
| 418 | int k; | 
|---|
| 419 | quint32 nScanCode; | 
|---|
| 420 | quint32 nVirtualKey; | 
|---|
| 421 | quint32 nModifiers; | 
|---|
| 422 | ushort c; | 
|---|
| 423 | ushort autor:1; | 
|---|
| 424 | // ushort reserved:15; | 
|---|
| 425 | }; | 
|---|
| 426 |  | 
|---|
| 427 |  | 
|---|
| 428 | class Q_GUI_EXPORT QFocusEvent : public QEvent | 
|---|
| 429 | { | 
|---|
| 430 | public: | 
|---|
| 431 | explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason); | 
|---|
| 432 | ~QFocusEvent(); | 
|---|
| 433 |  | 
|---|
| 434 | inline bool gotFocus() const { return type() == FocusIn; } | 
|---|
| 435 | inline bool lostFocus() const { return type() == FocusOut; } | 
|---|
| 436 |  | 
|---|
| 437 | Qt::FocusReason reason() const; | 
|---|
| 438 |  | 
|---|
| 439 | private: | 
|---|
| 440 | Qt::FocusReason m_reason; | 
|---|
| 441 | }; | 
|---|
| 442 |  | 
|---|
| 443 |  | 
|---|
| 444 | class Q_GUI_EXPORT QPaintEvent : public QEvent | 
|---|
| 445 | { | 
|---|
| 446 | public: | 
|---|
| 447 | explicit QPaintEvent(const QRegion& paintRegion); | 
|---|
| 448 | explicit QPaintEvent(const QRect &paintRect); | 
|---|
| 449 | ~QPaintEvent(); | 
|---|
| 450 |  | 
|---|
| 451 | inline const QRect &rect() const { return m_rect; } | 
|---|
| 452 | inline const QRegion ®ion() const { return m_region; } | 
|---|
| 453 |  | 
|---|
| 454 | protected: | 
|---|
| 455 | QRect m_rect; | 
|---|
| 456 | QRegion m_region; | 
|---|
| 457 | bool m_erased; | 
|---|
| 458 | }; | 
|---|
| 459 |  | 
|---|
| 460 | class Q_GUI_EXPORT QMoveEvent : public QEvent | 
|---|
| 461 | { | 
|---|
| 462 | public: | 
|---|
| 463 | QMoveEvent(const QPoint &pos, const QPoint &oldPos); | 
|---|
| 464 | ~QMoveEvent(); | 
|---|
| 465 |  | 
|---|
| 466 | inline const QPoint &pos() const { return p; } | 
|---|
| 467 | inline const QPoint &oldPos() const { return oldp;} | 
|---|
| 468 | protected: | 
|---|
| 469 | QPoint p, oldp; | 
|---|
| 470 | friend class QApplication; | 
|---|
| 471 | }; | 
|---|
| 472 |  | 
|---|
| 473 | class Q_GUI_EXPORT QExposeEvent : public QEvent | 
|---|
| 474 | { | 
|---|
| 475 | public: | 
|---|
| 476 | explicit QExposeEvent(const QRegion &rgn); | 
|---|
| 477 | ~QExposeEvent(); | 
|---|
| 478 |  | 
|---|
| 479 | inline const QRegion ®ion() const { return rgn; } | 
|---|
| 480 |  | 
|---|
| 481 | protected: | 
|---|
| 482 | QRegion rgn; | 
|---|
| 483 | }; | 
|---|
| 484 |  | 
|---|
| 485 | class Q_GUI_EXPORT QPlatformSurfaceEvent : public QEvent | 
|---|
| 486 | { | 
|---|
| 487 | public: | 
|---|
| 488 | enum SurfaceEventType { | 
|---|
| 489 | SurfaceCreated, | 
|---|
| 490 | SurfaceAboutToBeDestroyed | 
|---|
| 491 | }; | 
|---|
| 492 |  | 
|---|
| 493 | explicit QPlatformSurfaceEvent(SurfaceEventType surfaceEventType); | 
|---|
| 494 | ~QPlatformSurfaceEvent(); | 
|---|
| 495 |  | 
|---|
| 496 | inline SurfaceEventType surfaceEventType() const { return m_surfaceEventType; } | 
|---|
| 497 |  | 
|---|
| 498 | protected: | 
|---|
| 499 | SurfaceEventType m_surfaceEventType; | 
|---|
| 500 | }; | 
|---|
| 501 |  | 
|---|
| 502 | class Q_GUI_EXPORT QResizeEvent : public QEvent | 
|---|
| 503 | { | 
|---|
| 504 | public: | 
|---|
| 505 | QResizeEvent(const QSize &size, const QSize &oldSize); | 
|---|
| 506 | ~QResizeEvent(); | 
|---|
| 507 |  | 
|---|
| 508 | inline const QSize &size() const { return s; } | 
|---|
| 509 | inline const QSize &oldSize()const { return olds;} | 
|---|
| 510 | protected: | 
|---|
| 511 | QSize s, olds; | 
|---|
| 512 | friend class QApplication; | 
|---|
| 513 | }; | 
|---|
| 514 |  | 
|---|
| 515 |  | 
|---|
| 516 | class Q_GUI_EXPORT QCloseEvent : public QEvent | 
|---|
| 517 | { | 
|---|
| 518 | public: | 
|---|
| 519 | QCloseEvent(); | 
|---|
| 520 | ~QCloseEvent(); | 
|---|
| 521 | }; | 
|---|
| 522 |  | 
|---|
| 523 |  | 
|---|
| 524 | class Q_GUI_EXPORT QIconDragEvent : public QEvent | 
|---|
| 525 | { | 
|---|
| 526 | public: | 
|---|
| 527 | QIconDragEvent(); | 
|---|
| 528 | ~QIconDragEvent(); | 
|---|
| 529 | }; | 
|---|
| 530 |  | 
|---|
| 531 |  | 
|---|
| 532 | class Q_GUI_EXPORT QShowEvent : public QEvent | 
|---|
| 533 | { | 
|---|
| 534 | public: | 
|---|
| 535 | QShowEvent(); | 
|---|
| 536 | ~QShowEvent(); | 
|---|
| 537 | }; | 
|---|
| 538 |  | 
|---|
| 539 |  | 
|---|
| 540 | class Q_GUI_EXPORT QHideEvent : public QEvent | 
|---|
| 541 | { | 
|---|
| 542 | public: | 
|---|
| 543 | QHideEvent(); | 
|---|
| 544 | ~QHideEvent(); | 
|---|
| 545 | }; | 
|---|
| 546 |  | 
|---|
| 547 | #ifndef QT_NO_CONTEXTMENU | 
|---|
| 548 | class Q_GUI_EXPORT  : public QInputEvent | 
|---|
| 549 | { | 
|---|
| 550 | public: | 
|---|
| 551 | enum  { , ,  }; | 
|---|
| 552 |  | 
|---|
| 553 | (Reason reason, const QPoint &pos, const QPoint &globalPos, | 
|---|
| 554 | Qt::KeyboardModifiers modifiers); | 
|---|
| 555 | (Reason reason, const QPoint &pos, const QPoint &globalPos); | 
|---|
| 556 | (Reason reason, const QPoint &pos); | 
|---|
| 557 | (); | 
|---|
| 558 |  | 
|---|
| 559 | inline int () const { return p.x(); } | 
|---|
| 560 | inline int () const { return p.y(); } | 
|---|
| 561 | inline int () const { return gp.x(); } | 
|---|
| 562 | inline int () const { return gp.y(); } | 
|---|
| 563 |  | 
|---|
| 564 | inline const QPoint& () const { return p; } | 
|---|
| 565 | inline const QPoint& () const { return gp; } | 
|---|
| 566 |  | 
|---|
| 567 | inline Reason () const { return Reason(reas); } | 
|---|
| 568 |  | 
|---|
| 569 | protected: | 
|---|
| 570 | QPoint ; | 
|---|
| 571 | QPoint ; | 
|---|
| 572 | uint  : 8; | 
|---|
| 573 | }; | 
|---|
| 574 | #endif // QT_NO_CONTEXTMENU | 
|---|
| 575 |  | 
|---|
| 576 | #ifndef QT_NO_INPUTMETHOD | 
|---|
| 577 | class Q_GUI_EXPORT QInputMethodEvent : public QEvent | 
|---|
| 578 | { | 
|---|
| 579 | public: | 
|---|
| 580 | enum AttributeType { | 
|---|
| 581 | TextFormat, | 
|---|
| 582 | Cursor, | 
|---|
| 583 | Language, | 
|---|
| 584 | Ruby, | 
|---|
| 585 | Selection | 
|---|
| 586 | }; | 
|---|
| 587 | class Attribute { | 
|---|
| 588 | public: | 
|---|
| 589 | Attribute(AttributeType typ, int s, int l, QVariant val) : type(typ), start(s), length(l), value(std::move(val)) {} | 
|---|
| 590 | Attribute(AttributeType typ, int s, int l) : type(typ), start(s), length(l), value() {} | 
|---|
| 591 |  | 
|---|
| 592 | AttributeType type; | 
|---|
| 593 | int start; | 
|---|
| 594 | int length; | 
|---|
| 595 | QVariant value; | 
|---|
| 596 | }; | 
|---|
| 597 | QInputMethodEvent(); | 
|---|
| 598 | QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes); | 
|---|
| 599 | ~QInputMethodEvent(); | 
|---|
| 600 |  | 
|---|
| 601 | void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0); | 
|---|
| 602 | inline const QList<Attribute> &attributes() const { return attrs; } | 
|---|
| 603 | inline const QString &preeditString() const { return preedit; } | 
|---|
| 604 |  | 
|---|
| 605 | inline const QString &commitString() const { return commit; } | 
|---|
| 606 | inline int replacementStart() const { return replace_from; } | 
|---|
| 607 | inline int replacementLength() const { return replace_length; } | 
|---|
| 608 |  | 
|---|
| 609 | QInputMethodEvent(const QInputMethodEvent &other); | 
|---|
| 610 |  | 
|---|
| 611 | private: | 
|---|
| 612 | QString preedit; | 
|---|
| 613 | QList<Attribute> attrs; | 
|---|
| 614 | QString commit; | 
|---|
| 615 | int replace_from; | 
|---|
| 616 | int replace_length; | 
|---|
| 617 | }; | 
|---|
| 618 | Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE); | 
|---|
| 619 |  | 
|---|
| 620 | class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent | 
|---|
| 621 | { | 
|---|
| 622 | public: | 
|---|
| 623 | explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries); | 
|---|
| 624 | ~QInputMethodQueryEvent(); | 
|---|
| 625 |  | 
|---|
| 626 | Qt::InputMethodQueries queries() const { return m_queries; } | 
|---|
| 627 |  | 
|---|
| 628 | void setValue(Qt::InputMethodQuery query, const QVariant &value); | 
|---|
| 629 | QVariant value(Qt::InputMethodQuery query) const; | 
|---|
| 630 | private: | 
|---|
| 631 | Qt::InputMethodQueries m_queries; | 
|---|
| 632 | struct QueryPair { | 
|---|
| 633 | Qt::InputMethodQuery query; | 
|---|
| 634 | QVariant value; | 
|---|
| 635 | }; | 
|---|
| 636 | friend QTypeInfo<QueryPair>; | 
|---|
| 637 | QVector<QueryPair> m_values; | 
|---|
| 638 | }; | 
|---|
| 639 | Q_DECLARE_TYPEINFO(QInputMethodQueryEvent::QueryPair, Q_MOVABLE_TYPE); | 
|---|
| 640 |  | 
|---|
| 641 | #endif // QT_NO_INPUTMETHOD | 
|---|
| 642 |  | 
|---|
| 643 | #if QT_CONFIG(draganddrop) | 
|---|
| 644 |  | 
|---|
| 645 | class QMimeData; | 
|---|
| 646 |  | 
|---|
| 647 | class Q_GUI_EXPORT QDropEvent : public QEvent | 
|---|
| 648 | { | 
|---|
| 649 | public: | 
|---|
| 650 | QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data, | 
|---|
| 651 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop); | 
|---|
| 652 | ~QDropEvent(); | 
|---|
| 653 |  | 
|---|
| 654 | inline QPoint pos() const { return p.toPoint(); } | 
|---|
| 655 | inline const QPointF &posF() const { return p; } | 
|---|
| 656 | inline Qt::MouseButtons mouseButtons() const { return mouseState; } | 
|---|
| 657 | inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; } | 
|---|
| 658 |  | 
|---|
| 659 | inline Qt::DropActions possibleActions() const { return act; } | 
|---|
| 660 | inline Qt::DropAction proposedAction() const { return default_action; } | 
|---|
| 661 | inline void acceptProposedAction() { drop_action = default_action; accept(); } | 
|---|
| 662 |  | 
|---|
| 663 | inline Qt::DropAction dropAction() const { return drop_action; } | 
|---|
| 664 | void setDropAction(Qt::DropAction action); | 
|---|
| 665 |  | 
|---|
| 666 | QObject* source() const; | 
|---|
| 667 | inline const QMimeData *mimeData() const { return mdata; } | 
|---|
| 668 |  | 
|---|
| 669 | protected: | 
|---|
| 670 | friend class QApplication; | 
|---|
| 671 | QPointF p; | 
|---|
| 672 | Qt::MouseButtons mouseState; | 
|---|
| 673 | Qt::KeyboardModifiers modState; | 
|---|
| 674 | Qt::DropActions act; | 
|---|
| 675 | Qt::DropAction drop_action; | 
|---|
| 676 | Qt::DropAction default_action; | 
|---|
| 677 | const QMimeData *mdata; | 
|---|
| 678 | }; | 
|---|
| 679 |  | 
|---|
| 680 |  | 
|---|
| 681 | class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent | 
|---|
| 682 | { | 
|---|
| 683 | public: | 
|---|
| 684 | QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, | 
|---|
| 685 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove); | 
|---|
| 686 | ~QDragMoveEvent(); | 
|---|
| 687 |  | 
|---|
| 688 | inline QRect answerRect() const { return rect; } | 
|---|
| 689 |  | 
|---|
| 690 | inline void accept() { QDropEvent::accept(); } | 
|---|
| 691 | inline void ignore() { QDropEvent::ignore(); } | 
|---|
| 692 |  | 
|---|
| 693 | inline void accept(const QRect & r) { accept(); rect = r; } | 
|---|
| 694 | inline void ignore(const QRect & r) { ignore(); rect = r; } | 
|---|
| 695 |  | 
|---|
| 696 | protected: | 
|---|
| 697 | QRect rect; | 
|---|
| 698 | }; | 
|---|
| 699 |  | 
|---|
| 700 |  | 
|---|
| 701 | class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent | 
|---|
| 702 | { | 
|---|
| 703 | public: | 
|---|
| 704 | QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data, | 
|---|
| 705 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers); | 
|---|
| 706 | ~QDragEnterEvent(); | 
|---|
| 707 | }; | 
|---|
| 708 |  | 
|---|
| 709 |  | 
|---|
| 710 | class Q_GUI_EXPORT QDragLeaveEvent : public QEvent | 
|---|
| 711 | { | 
|---|
| 712 | public: | 
|---|
| 713 | QDragLeaveEvent(); | 
|---|
| 714 | ~QDragLeaveEvent(); | 
|---|
| 715 | }; | 
|---|
| 716 | #endif // QT_CONFIG(draganddrop) | 
|---|
| 717 |  | 
|---|
| 718 |  | 
|---|
| 719 | class Q_GUI_EXPORT QHelpEvent : public QEvent | 
|---|
| 720 | { | 
|---|
| 721 | public: | 
|---|
| 722 | QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos); | 
|---|
| 723 | ~QHelpEvent(); | 
|---|
| 724 |  | 
|---|
| 725 | inline int x() const { return p.x(); } | 
|---|
| 726 | inline int y() const { return p.y(); } | 
|---|
| 727 | inline int globalX() const { return gp.x(); } | 
|---|
| 728 | inline int globalY() const { return gp.y(); } | 
|---|
| 729 |  | 
|---|
| 730 | inline const QPoint& pos()  const { return p; } | 
|---|
| 731 | inline const QPoint& globalPos() const { return gp; } | 
|---|
| 732 |  | 
|---|
| 733 | private: | 
|---|
| 734 | QPoint p; | 
|---|
| 735 | QPoint gp; | 
|---|
| 736 | }; | 
|---|
| 737 |  | 
|---|
| 738 | #ifndef QT_NO_STATUSTIP | 
|---|
| 739 | class Q_GUI_EXPORT QStatusTipEvent : public QEvent | 
|---|
| 740 | { | 
|---|
| 741 | public: | 
|---|
| 742 | explicit QStatusTipEvent(const QString &tip); | 
|---|
| 743 | ~QStatusTipEvent(); | 
|---|
| 744 |  | 
|---|
| 745 | inline QString tip() const { return s; } | 
|---|
| 746 | private: | 
|---|
| 747 | QString s; | 
|---|
| 748 | }; | 
|---|
| 749 | #endif | 
|---|
| 750 |  | 
|---|
| 751 | #if QT_CONFIG(whatsthis) | 
|---|
| 752 | class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent | 
|---|
| 753 | { | 
|---|
| 754 | public: | 
|---|
| 755 | explicit QWhatsThisClickedEvent(const QString &href); | 
|---|
| 756 | ~QWhatsThisClickedEvent(); | 
|---|
| 757 |  | 
|---|
| 758 | inline QString href() const { return s; } | 
|---|
| 759 | private: | 
|---|
| 760 | QString s; | 
|---|
| 761 | }; | 
|---|
| 762 | #endif | 
|---|
| 763 |  | 
|---|
| 764 | #ifndef QT_NO_ACTION | 
|---|
| 765 | class Q_GUI_EXPORT QActionEvent : public QEvent | 
|---|
| 766 | { | 
|---|
| 767 | QAction *act, *bef; | 
|---|
| 768 | public: | 
|---|
| 769 | QActionEvent(int type, QAction *action, QAction *before = nullptr); | 
|---|
| 770 | ~QActionEvent(); | 
|---|
| 771 |  | 
|---|
| 772 | inline QAction *action() const { return act; } | 
|---|
| 773 | inline QAction *before() const { return bef; } | 
|---|
| 774 | }; | 
|---|
| 775 | #endif | 
|---|
| 776 |  | 
|---|
| 777 | class Q_GUI_EXPORT QFileOpenEvent : public QEvent | 
|---|
| 778 | { | 
|---|
| 779 | public: | 
|---|
| 780 | explicit QFileOpenEvent(const QString &file); | 
|---|
| 781 | explicit QFileOpenEvent(const QUrl &url); | 
|---|
| 782 | ~QFileOpenEvent(); | 
|---|
| 783 |  | 
|---|
| 784 | inline QString file() const { return f; } | 
|---|
| 785 | QUrl url() const { return m_url; } | 
|---|
| 786 | bool openFile(QFile &file, QIODevice::OpenMode flags) const; | 
|---|
| 787 | private: | 
|---|
| 788 | QString f; | 
|---|
| 789 | QUrl m_url; | 
|---|
| 790 | }; | 
|---|
| 791 |  | 
|---|
| 792 | #ifndef QT_NO_TOOLBAR | 
|---|
| 793 | class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent | 
|---|
| 794 | { | 
|---|
| 795 | public: | 
|---|
| 796 | explicit QToolBarChangeEvent(bool t); | 
|---|
| 797 | ~QToolBarChangeEvent(); | 
|---|
| 798 |  | 
|---|
| 799 | inline bool toggle() const { return tog; } | 
|---|
| 800 | private: | 
|---|
| 801 | uint tog : 1; | 
|---|
| 802 | }; | 
|---|
| 803 | #endif | 
|---|
| 804 |  | 
|---|
| 805 | #ifndef QT_NO_SHORTCUT | 
|---|
| 806 | class Q_GUI_EXPORT QShortcutEvent : public QEvent | 
|---|
| 807 | { | 
|---|
| 808 | public: | 
|---|
| 809 | QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false); | 
|---|
| 810 | ~QShortcutEvent(); | 
|---|
| 811 |  | 
|---|
| 812 | inline const QKeySequence &key() const { return sequence; } | 
|---|
| 813 | inline int shortcutId() const { return sid; } | 
|---|
| 814 | inline bool isAmbiguous() const { return ambig; } | 
|---|
| 815 | protected: | 
|---|
| 816 | QKeySequence sequence; | 
|---|
| 817 | bool ambig; | 
|---|
| 818 | int  sid; | 
|---|
| 819 | }; | 
|---|
| 820 | #endif | 
|---|
| 821 |  | 
|---|
| 822 | class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent | 
|---|
| 823 | { | 
|---|
| 824 | public: | 
|---|
| 825 | explicit QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride = false); | 
|---|
| 826 | ~QWindowStateChangeEvent(); | 
|---|
| 827 |  | 
|---|
| 828 | inline Qt::WindowStates oldState() const { return ostate; } | 
|---|
| 829 | bool isOverride() const; | 
|---|
| 830 |  | 
|---|
| 831 | private: | 
|---|
| 832 | Qt::WindowStates ostate; | 
|---|
| 833 | bool m_override; | 
|---|
| 834 | }; | 
|---|
| 835 |  | 
|---|
| 836 | #ifndef QT_NO_DEBUG_STREAM | 
|---|
| 837 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *); | 
|---|
| 838 | #endif | 
|---|
| 839 |  | 
|---|
| 840 | #ifndef QT_NO_SHORTCUT | 
|---|
| 841 | inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);} | 
|---|
| 842 | inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);} | 
|---|
| 843 | #endif // QT_NO_SHORTCUT | 
|---|
| 844 |  | 
|---|
| 845 | class Q_GUI_EXPORT QPointingDeviceUniqueId | 
|---|
| 846 | { | 
|---|
| 847 | Q_GADGET | 
|---|
| 848 | Q_PROPERTY(qint64 numericId READ numericId CONSTANT) | 
|---|
| 849 | public: | 
|---|
| 850 | Q_ALWAYS_INLINE | 
|---|
| 851 | Q_DECL_CONSTEXPR QPointingDeviceUniqueId() noexcept : m_numericId(-1) {} | 
|---|
| 852 | // compiler-generated copy/move ctor/assignment operators are ok! | 
|---|
| 853 | // compiler-generated dtor is ok! | 
|---|
| 854 |  | 
|---|
| 855 | static QPointingDeviceUniqueId fromNumericId(qint64 id); | 
|---|
| 856 |  | 
|---|
| 857 | Q_ALWAYS_INLINE Q_DECL_CONSTEXPR bool isValid() const noexcept { return m_numericId != -1; } | 
|---|
| 858 | qint64 numericId() const noexcept; | 
|---|
| 859 |  | 
|---|
| 860 | private: | 
|---|
| 861 | // TODO: for TUIO 2, or any other type of complex token ID, an internal | 
|---|
| 862 | // array (or hash) can be added to hold additional properties. | 
|---|
| 863 | // In this case, m_numericId will then turn into an index into that array (or hash). | 
|---|
| 864 | qint64 m_numericId; | 
|---|
| 865 | }; | 
|---|
| 866 | Q_DECLARE_TYPEINFO(QPointingDeviceUniqueId, Q_MOVABLE_TYPE); | 
|---|
| 867 |  | 
|---|
| 868 | #if 0 | 
|---|
| 869 | #pragma qt_sync_suspend_processing | 
|---|
| 870 | #endif | 
|---|
| 871 | template <> class QList<QPointingDeviceUniqueId> {}; // to prevent instantiation: use QVector instead | 
|---|
| 872 | #if 0 | 
|---|
| 873 | #pragma qt_sync_resume_processing | 
|---|
| 874 | #endif | 
|---|
| 875 |  | 
|---|
| 876 | Q_GUI_EXPORT bool operator==(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept; | 
|---|
| 877 | inline bool operator!=(QPointingDeviceUniqueId lhs, QPointingDeviceUniqueId rhs) noexcept | 
|---|
| 878 | { return !operator==(lhs, rhs); } | 
|---|
| 879 | Q_GUI_EXPORT uint qHash(QPointingDeviceUniqueId key, uint seed = 0) noexcept; | 
|---|
| 880 |  | 
|---|
| 881 |  | 
|---|
| 882 |  | 
|---|
| 883 | class QTouchEventTouchPointPrivate; | 
|---|
| 884 | class Q_GUI_EXPORT QTouchEvent : public QInputEvent | 
|---|
| 885 | { | 
|---|
| 886 | public: | 
|---|
| 887 | class Q_GUI_EXPORT TouchPoint | 
|---|
| 888 | { | 
|---|
| 889 | public: | 
|---|
| 890 | enum InfoFlag { | 
|---|
| 891 | Pen  = 0x0001, | 
|---|
| 892 | Token = 0x0002 | 
|---|
| 893 | }; | 
|---|
| 894 | #ifndef Q_MOC_RUN | 
|---|
| 895 | // otherwise moc gives | 
|---|
| 896 | // Error: Meta object features not supported for nested classes | 
|---|
| 897 | Q_DECLARE_FLAGS(InfoFlags, InfoFlag) | 
|---|
| 898 | #endif | 
|---|
| 899 |  | 
|---|
| 900 | explicit TouchPoint(int id = -1); | 
|---|
| 901 | TouchPoint(const TouchPoint &other); | 
|---|
| 902 | TouchPoint(TouchPoint &&other) noexcept | 
|---|
| 903 | : d(nullptr) | 
|---|
| 904 | { qSwap(d, other.d); } | 
|---|
| 905 | TouchPoint &operator=(TouchPoint &&other) noexcept | 
|---|
| 906 | { qSwap(d, other.d); return *this; } | 
|---|
| 907 | ~TouchPoint(); | 
|---|
| 908 |  | 
|---|
| 909 | TouchPoint &operator=(const TouchPoint &other) | 
|---|
| 910 | { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; } | 
|---|
| 911 |  | 
|---|
| 912 | void swap(TouchPoint &other) noexcept | 
|---|
| 913 | { qSwap(d, other.d); } | 
|---|
| 914 |  | 
|---|
| 915 | int id() const; | 
|---|
| 916 | QPointingDeviceUniqueId uniqueId() const; | 
|---|
| 917 |  | 
|---|
| 918 | Qt::TouchPointState state() const; | 
|---|
| 919 |  | 
|---|
| 920 | QPointF pos() const; | 
|---|
| 921 | QPointF startPos() const; | 
|---|
| 922 | QPointF lastPos() const; | 
|---|
| 923 |  | 
|---|
| 924 | QPointF scenePos() const; | 
|---|
| 925 | QPointF startScenePos() const; | 
|---|
| 926 | QPointF lastScenePos() const; | 
|---|
| 927 |  | 
|---|
| 928 | QPointF screenPos() const; | 
|---|
| 929 | QPointF startScreenPos() const; | 
|---|
| 930 | QPointF lastScreenPos() const; | 
|---|
| 931 |  | 
|---|
| 932 | QPointF normalizedPos() const; | 
|---|
| 933 | QPointF startNormalizedPos() const; | 
|---|
| 934 | QPointF lastNormalizedPos() const; | 
|---|
| 935 |  | 
|---|
| 936 | #if QT_DEPRECATED_SINCE(5, 15) | 
|---|
| 937 | // All these are actually deprecated since 5.9, in docs | 
|---|
| 938 | QT_DEPRECATED_VERSION_X_5_15( "Use pos() and ellipseDiameters()") | 
|---|
| 939 | QRectF rect() const; | 
|---|
| 940 | QT_DEPRECATED_VERSION_X_5_15( "Use scenePos() and ellipseDiameters()") | 
|---|
| 941 | QRectF sceneRect() const; | 
|---|
| 942 | QT_DEPRECATED_VERSION_X_5_15( "Use screenPos() and ellipseDiameters()") | 
|---|
| 943 | QRectF screenRect() const; | 
|---|
| 944 |  | 
|---|
| 945 | // internal | 
|---|
| 946 | QT_DEPRECATED_VERSION_X_5_15( "Use setPos() and setEllipseDiameters()") | 
|---|
| 947 | void setRect(const QRectF &rect); // deprecated | 
|---|
| 948 | QT_DEPRECATED_VERSION_X_5_15( "Use setScenePos() and setEllipseDiameters()") | 
|---|
| 949 | void setSceneRect(const QRectF &sceneRect); // deprecated | 
|---|
| 950 | QT_DEPRECATED_VERSION_X_5_15( "Use setScreenPos() and setEllipseDiameters()") | 
|---|
| 951 | void setScreenRect(const QRectF &screenRect); // deprecated | 
|---|
| 952 | #endif | 
|---|
| 953 | qreal pressure() const; | 
|---|
| 954 | qreal rotation() const; | 
|---|
| 955 | QSizeF ellipseDiameters() const; | 
|---|
| 956 |  | 
|---|
| 957 | QVector2D velocity() const; | 
|---|
| 958 | InfoFlags flags() const; | 
|---|
| 959 | QVector<QPointF> rawScreenPositions() const; | 
|---|
| 960 |  | 
|---|
| 961 | // internal | 
|---|
| 962 | void setId(int id); | 
|---|
| 963 | void setUniqueId(qint64 uid); | 
|---|
| 964 | void setState(Qt::TouchPointStates state); | 
|---|
| 965 | void setPos(const QPointF &pos); | 
|---|
| 966 | void setScenePos(const QPointF &scenePos); | 
|---|
| 967 | void setScreenPos(const QPointF &screenPos); | 
|---|
| 968 | void setNormalizedPos(const QPointF &normalizedPos); | 
|---|
| 969 | void setStartPos(const QPointF &startPos); | 
|---|
| 970 | void setStartScenePos(const QPointF &startScenePos); | 
|---|
| 971 | void setStartScreenPos(const QPointF &startScreenPos); | 
|---|
| 972 | void setStartNormalizedPos(const QPointF &startNormalizedPos); | 
|---|
| 973 | void setLastPos(const QPointF &lastPos); | 
|---|
| 974 | void setLastScenePos(const QPointF &lastScenePos); | 
|---|
| 975 | void setLastScreenPos(const QPointF &lastScreenPos); | 
|---|
| 976 | void setLastNormalizedPos(const QPointF &lastNormalizedPos); | 
|---|
| 977 | void setPressure(qreal pressure); | 
|---|
| 978 | void setRotation(qreal angle); | 
|---|
| 979 | void setEllipseDiameters(const QSizeF &dia); | 
|---|
| 980 | void setVelocity(const QVector2D &v); | 
|---|
| 981 | void setFlags(InfoFlags flags); | 
|---|
| 982 | void setRawScreenPositions(const QVector<QPointF> &positions); | 
|---|
| 983 |  | 
|---|
| 984 | private: | 
|---|
| 985 | QTouchEventTouchPointPrivate *d; | 
|---|
| 986 | friend class QGuiApplication; | 
|---|
| 987 | friend class QGuiApplicationPrivate; | 
|---|
| 988 | friend class QApplication; | 
|---|
| 989 | friend class QApplicationPrivate; | 
|---|
| 990 | friend class QQuickPointerTouchEvent; | 
|---|
| 991 | friend class QQuickMultiPointTouchArea; | 
|---|
| 992 | }; | 
|---|
| 993 |  | 
|---|
| 994 | #if QT_DEPRECATED_SINCE(5, 0) | 
|---|
| 995 | enum DeviceType { | 
|---|
| 996 | TouchScreen, | 
|---|
| 997 | TouchPad | 
|---|
| 998 | }; | 
|---|
| 999 | #endif | 
|---|
| 1000 |  | 
|---|
| 1001 | explicit QTouchEvent(QEvent::Type eventType, | 
|---|
| 1002 | QTouchDevice *device = nullptr, | 
|---|
| 1003 | Qt::KeyboardModifiers modifiers = Qt::NoModifier, | 
|---|
| 1004 | Qt::TouchPointStates touchPointStates = Qt::TouchPointStates(), | 
|---|
| 1005 | const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>()); | 
|---|
| 1006 | ~QTouchEvent(); | 
|---|
| 1007 |  | 
|---|
| 1008 | inline QWindow *window() const { return _window; } | 
|---|
| 1009 | inline QObject *target() const { return _target; } | 
|---|
| 1010 | #if QT_DEPRECATED_SINCE(5, 0) | 
|---|
| 1011 | QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); } | 
|---|
| 1012 | #endif | 
|---|
| 1013 | inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; } | 
|---|
| 1014 | inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; } | 
|---|
| 1015 | inline QTouchDevice *device() const { return _device; } | 
|---|
| 1016 |  | 
|---|
| 1017 | // internal | 
|---|
| 1018 | inline void setWindow(QWindow *awindow) { _window = awindow; } | 
|---|
| 1019 | inline void setTarget(QObject *atarget) { _target = atarget; } | 
|---|
| 1020 | inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; } | 
|---|
| 1021 | inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; } | 
|---|
| 1022 | inline void setDevice(QTouchDevice *adevice) { _device = adevice; } | 
|---|
| 1023 |  | 
|---|
| 1024 | protected: | 
|---|
| 1025 | QWindow *_window; | 
|---|
| 1026 | QObject *_target; | 
|---|
| 1027 | QTouchDevice *_device; | 
|---|
| 1028 | Qt::TouchPointStates _touchPointStates; | 
|---|
| 1029 | QList<QTouchEvent::TouchPoint> _touchPoints; | 
|---|
| 1030 |  | 
|---|
| 1031 | friend class QGuiApplication; | 
|---|
| 1032 | friend class QGuiApplicationPrivate; | 
|---|
| 1033 | friend class QApplication; | 
|---|
| 1034 | friend class QApplicationPrivate; | 
|---|
| 1035 | #ifndef QT_NO_GRAPHICSVIEW | 
|---|
| 1036 | friend class QGraphicsScenePrivate; // direct access to _touchPoints | 
|---|
| 1037 | #endif | 
|---|
| 1038 | }; | 
|---|
| 1039 | Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE); | 
|---|
| 1040 | Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags) | 
|---|
| 1041 |  | 
|---|
| 1042 | #ifndef QT_NO_DEBUG_STREAM | 
|---|
| 1043 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QTouchEvent::TouchPoint &); | 
|---|
| 1044 | #endif | 
|---|
| 1045 |  | 
|---|
| 1046 | class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent | 
|---|
| 1047 | { | 
|---|
| 1048 | public: | 
|---|
| 1049 | explicit QScrollPrepareEvent(const QPointF &startPos); | 
|---|
| 1050 | ~QScrollPrepareEvent(); | 
|---|
| 1051 |  | 
|---|
| 1052 | QPointF startPos() const; | 
|---|
| 1053 |  | 
|---|
| 1054 | QSizeF viewportSize() const; | 
|---|
| 1055 | QRectF contentPosRange() const; | 
|---|
| 1056 | QPointF contentPos() const; | 
|---|
| 1057 |  | 
|---|
| 1058 | void setViewportSize(const QSizeF &size); | 
|---|
| 1059 | void setContentPosRange(const QRectF &rect); | 
|---|
| 1060 | void setContentPos(const QPointF &pos); | 
|---|
| 1061 |  | 
|---|
| 1062 | private: | 
|---|
| 1063 | QObject* m_target; // Qt 6 remove. | 
|---|
| 1064 | QPointF m_startPos; | 
|---|
| 1065 | QSizeF m_viewportSize; | 
|---|
| 1066 | QRectF m_contentPosRange; | 
|---|
| 1067 | QPointF m_contentPos; | 
|---|
| 1068 | }; | 
|---|
| 1069 |  | 
|---|
| 1070 |  | 
|---|
| 1071 | class Q_GUI_EXPORT QScrollEvent : public QEvent | 
|---|
| 1072 | { | 
|---|
| 1073 | public: | 
|---|
| 1074 | enum ScrollState | 
|---|
| 1075 | { | 
|---|
| 1076 | ScrollStarted, | 
|---|
| 1077 | ScrollUpdated, | 
|---|
| 1078 | ScrollFinished | 
|---|
| 1079 | }; | 
|---|
| 1080 |  | 
|---|
| 1081 | QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState); | 
|---|
| 1082 | ~QScrollEvent(); | 
|---|
| 1083 |  | 
|---|
| 1084 | QPointF contentPos() const; | 
|---|
| 1085 | QPointF overshootDistance() const; | 
|---|
| 1086 | ScrollState scrollState() const; | 
|---|
| 1087 |  | 
|---|
| 1088 | private: | 
|---|
| 1089 | QPointF m_contentPos; | 
|---|
| 1090 | QPointF m_overshoot; | 
|---|
| 1091 | QScrollEvent::ScrollState m_state; | 
|---|
| 1092 | }; | 
|---|
| 1093 |  | 
|---|
| 1094 | class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent | 
|---|
| 1095 | { | 
|---|
| 1096 | public: | 
|---|
| 1097 | QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation orientation); | 
|---|
| 1098 | ~QScreenOrientationChangeEvent(); | 
|---|
| 1099 |  | 
|---|
| 1100 | QScreen *screen() const; | 
|---|
| 1101 | Qt::ScreenOrientation orientation() const; | 
|---|
| 1102 |  | 
|---|
| 1103 | private: | 
|---|
| 1104 | QScreen *m_screen; | 
|---|
| 1105 | Qt::ScreenOrientation m_orientation; | 
|---|
| 1106 | }; | 
|---|
| 1107 |  | 
|---|
| 1108 | class Q_GUI_EXPORT QApplicationStateChangeEvent : public QEvent | 
|---|
| 1109 | { | 
|---|
| 1110 | public: | 
|---|
| 1111 | explicit QApplicationStateChangeEvent(Qt::ApplicationState state); | 
|---|
| 1112 | Qt::ApplicationState applicationState() const; | 
|---|
| 1113 |  | 
|---|
| 1114 | private: | 
|---|
| 1115 | Qt::ApplicationState m_applicationState; | 
|---|
| 1116 | }; | 
|---|
| 1117 |  | 
|---|
| 1118 | QT_END_NAMESPACE | 
|---|
| 1119 |  | 
|---|
| 1120 | #endif // QEVENT_H | 
|---|
| 1121 |  | 
|---|