1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at qt-info@nokia.com.
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QEVENT_H
|
---|
43 | #define QEVENT_H
|
---|
44 |
|
---|
45 | #include <QtGui/qwindowdefs.h>
|
---|
46 | #include <QtCore/qobject.h>
|
---|
47 | #include <QtGui/qregion.h>
|
---|
48 | #include <QtCore/qnamespace.h>
|
---|
49 | #include <QtCore/qstring.h>
|
---|
50 | #include <QtGui/qkeysequence.h>
|
---|
51 | #include <QtCore/qcoreevent.h>
|
---|
52 | #include <QtGui/qmime.h>
|
---|
53 | #include <QtGui/qdrag.h>
|
---|
54 | #include <QtCore/qvariant.h>
|
---|
55 | #include <QtCore/qmap.h>
|
---|
56 | #include <QtCore/qset.h>
|
---|
57 |
|
---|
58 | QT_BEGIN_HEADER
|
---|
59 |
|
---|
60 | QT_BEGIN_NAMESPACE
|
---|
61 |
|
---|
62 | QT_MODULE(Gui)
|
---|
63 |
|
---|
64 | class QAction;
|
---|
65 | #ifndef QT_NO_GESTURES
|
---|
66 | class QGesture;
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | class Q_GUI_EXPORT QInputEvent : public QEvent
|
---|
70 | {
|
---|
71 | public:
|
---|
72 | QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
|
---|
73 | ~QInputEvent();
|
---|
74 | inline Qt::KeyboardModifiers modifiers() const { return modState; }
|
---|
75 | inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
|
---|
76 | protected:
|
---|
77 | Qt::KeyboardModifiers modState;
|
---|
78 | };
|
---|
79 |
|
---|
80 | class Q_GUI_EXPORT QMouseEvent : public QInputEvent
|
---|
81 | {
|
---|
82 | public:
|
---|
83 | QMouseEvent(Type type, const QPoint &pos, Qt::MouseButton button,
|
---|
84 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
|
---|
85 | QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
|
---|
86 | Qt::MouseButton button, Qt::MouseButtons buttons,
|
---|
87 | Qt::KeyboardModifiers modifiers);
|
---|
88 | ~QMouseEvent();
|
---|
89 |
|
---|
90 | inline const QPoint &pos() const { return p; }
|
---|
91 | inline const QPoint &globalPos() const { return g; }
|
---|
92 | inline int x() const { return p.x(); }
|
---|
93 | inline int y() const { return p.y(); }
|
---|
94 | inline int globalX() const { return g.x(); }
|
---|
95 | inline int globalY() const { return g.y(); }
|
---|
96 | inline Qt::MouseButton button() const { return b; }
|
---|
97 | inline Qt::MouseButtons buttons() const { return mouseState; }
|
---|
98 |
|
---|
99 | static QMouseEvent *createExtendedMouseEvent(Type type, const QPointF &pos,
|
---|
100 | const QPoint &globalPos, Qt::MouseButton button,
|
---|
101 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
|
---|
102 | inline bool hasExtendedInfo() const { return reinterpret_cast<const QMouseEvent *>(d) == this; }
|
---|
103 | QPointF posF() const;
|
---|
104 |
|
---|
105 | #ifdef QT3_SUPPORT
|
---|
106 | QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, Qt::ButtonState button, int state);
|
---|
107 | QT3_SUPPORT_CONSTRUCTOR QMouseEvent(Type type, const QPoint &pos, const QPoint &globalPos,
|
---|
108 | Qt::ButtonState button, int state);
|
---|
109 | inline QT3_SUPPORT Qt::ButtonState state() const
|
---|
110 | { return Qt::ButtonState((mouseState^b)|int(modifiers())); }
|
---|
111 | inline QT3_SUPPORT Qt::ButtonState stateAfter() const
|
---|
112 | { return Qt::ButtonState(int(mouseState)|int(modifiers())); }
|
---|
113 | #endif
|
---|
114 | protected:
|
---|
115 | QPoint p, g;
|
---|
116 | Qt::MouseButton b;
|
---|
117 | Qt::MouseButtons mouseState;
|
---|
118 | };
|
---|
119 |
|
---|
120 | class Q_GUI_EXPORT QHoverEvent : public QEvent
|
---|
121 | {
|
---|
122 | public:
|
---|
123 | QHoverEvent(Type type, const QPoint &pos, const QPoint &oldPos);
|
---|
124 | ~QHoverEvent();
|
---|
125 |
|
---|
126 | inline const QPoint &pos() const { return p; }
|
---|
127 | inline const QPoint &oldPos() const { return op; }
|
---|
128 |
|
---|
129 | protected:
|
---|
130 | QPoint p, op;
|
---|
131 | };
|
---|
132 |
|
---|
133 | #ifndef QT_NO_WHEELEVENT
|
---|
134 | class Q_GUI_EXPORT QWheelEvent : public QInputEvent
|
---|
135 | {
|
---|
136 | public:
|
---|
137 | QWheelEvent(const QPoint &pos, int delta,
|
---|
138 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
|
---|
139 | Qt::Orientation orient = Qt::Vertical);
|
---|
140 | QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta,
|
---|
141 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
|
---|
142 | Qt::Orientation orient = Qt::Vertical);
|
---|
143 | ~QWheelEvent();
|
---|
144 |
|
---|
145 | inline int delta() const { return d; }
|
---|
146 | inline const QPoint &pos() const { return p; }
|
---|
147 | inline const QPoint &globalPos() const { return g; }
|
---|
148 | inline int x() const { return p.x(); }
|
---|
149 | inline int y() const { return p.y(); }
|
---|
150 | inline int globalX() const { return g.x(); }
|
---|
151 | inline int globalY() const { return g.y(); }
|
---|
152 |
|
---|
153 | inline Qt::MouseButtons buttons() const { return mouseState; }
|
---|
154 | Qt::Orientation orientation() const { return o; }
|
---|
155 |
|
---|
156 | #ifdef QT3_SUPPORT
|
---|
157 | QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, int delta, int state,
|
---|
158 | Qt::Orientation orient = Qt::Vertical);
|
---|
159 | QT3_SUPPORT_CONSTRUCTOR QWheelEvent(const QPoint &pos, const QPoint& globalPos, int delta, int state,
|
---|
160 | Qt::Orientation orient = Qt::Vertical);
|
---|
161 | inline QT3_SUPPORT Qt::ButtonState state() const
|
---|
162 | { return static_cast<Qt::ButtonState>(int(buttons())|int(modifiers())); }
|
---|
163 | #endif
|
---|
164 | protected:
|
---|
165 | QPoint p;
|
---|
166 | QPoint g;
|
---|
167 | int d;
|
---|
168 | Qt::MouseButtons mouseState;
|
---|
169 | Qt::Orientation o;
|
---|
170 | };
|
---|
171 | #endif
|
---|
172 |
|
---|
173 | #ifndef QT_NO_TABLETEVENT
|
---|
174 | class Q_GUI_EXPORT QTabletEvent : public QInputEvent
|
---|
175 | {
|
---|
176 | public:
|
---|
177 | enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse,
|
---|
178 | XFreeEraser /*internal*/, RotationStylus };
|
---|
179 | enum PointerType { UnknownPointer, Pen, Cursor, Eraser };
|
---|
180 | QTabletEvent(Type t, const QPoint &pos, const QPoint &globalPos, const QPointF &hiResGlobalPos,
|
---|
181 | int device, int pointerType, qreal pressure, int xTilt, int yTilt,
|
---|
182 | qreal tangentialPressure, qreal rotation, int z,
|
---|
183 | Qt::KeyboardModifiers keyState, qint64 uniqueID);
|
---|
184 | ~QTabletEvent();
|
---|
185 |
|
---|
186 | inline const QPoint &pos() const { return mPos; }
|
---|
187 | inline const QPoint &globalPos() const { return mGPos; }
|
---|
188 | inline const QPointF &hiResGlobalPos() const { return mHiResGlobalPos; }
|
---|
189 | inline int x() const { return mPos.x(); }
|
---|
190 | inline int y() const { return mPos.y(); }
|
---|
191 | inline int globalX() const { return mGPos.x(); }
|
---|
192 | inline int globalY() const { return mGPos.y(); }
|
---|
193 | inline qreal hiResGlobalX() const { return mHiResGlobalPos.x(); }
|
---|
194 | inline qreal hiResGlobalY() const { return mHiResGlobalPos.y(); }
|
---|
195 | inline TabletDevice device() const { return TabletDevice(mDev); }
|
---|
196 | inline PointerType pointerType() const { return PointerType(mPointerType); }
|
---|
197 | inline qint64 uniqueId() const { return mUnique; }
|
---|
198 | inline qreal pressure() const { return mPress; }
|
---|
199 | inline int z() const { return mZ; }
|
---|
200 | inline qreal tangentialPressure() const { return mTangential; }
|
---|
201 | inline qreal rotation() const { return mRot; }
|
---|
202 | inline int xTilt() const { return mXT; }
|
---|
203 | inline int yTilt() const { return mYT; }
|
---|
204 |
|
---|
205 | protected:
|
---|
206 | QPoint mPos, mGPos;
|
---|
207 | QPointF mHiResGlobalPos;
|
---|
208 | int mDev, mPointerType, mXT, mYT, mZ;
|
---|
209 | qreal mPress, mTangential, mRot;
|
---|
210 | qint64 mUnique;
|
---|
211 |
|
---|
212 | // I don't know what the future holds for tablets but there could be some
|
---|
213 | // new devices coming along, and there seem to be "holes" in the
|
---|
214 | // OS-specific events for this.
|
---|
215 | void *mExtra;
|
---|
216 | };
|
---|
217 | #endif // QT_NO_TABLETEVENT
|
---|
218 |
|
---|
219 | class Q_GUI_EXPORT QKeyEvent : public QInputEvent
|
---|
220 | {
|
---|
221 | public:
|
---|
222 | QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text = QString(),
|
---|
223 | bool autorep = false, ushort count = 1);
|
---|
224 | ~QKeyEvent();
|
---|
225 |
|
---|
226 | int key() const { return k; }
|
---|
227 | #ifndef QT_NO_SHORTCUT
|
---|
228 | bool matches(QKeySequence::StandardKey key) const;
|
---|
229 | #endif
|
---|
230 | Qt::KeyboardModifiers modifiers() const;
|
---|
231 | inline QString text() const { return txt; }
|
---|
232 | inline bool isAutoRepeat() const { return autor; }
|
---|
233 | inline int count() const { return int(c); }
|
---|
234 |
|
---|
235 | // Functions for the extended key event information
|
---|
236 | static QKeyEvent *createExtendedKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
|
---|
237 | quint32 nativeScanCode, quint32 nativeVirtualKey,
|
---|
238 | quint32 nativeModifiers,
|
---|
239 | const QString& text = QString(), bool autorep = false,
|
---|
240 | ushort count = 1);
|
---|
241 | inline bool hasExtendedInfo() const { return reinterpret_cast<const QKeyEvent*>(d) == this; }
|
---|
242 | quint32 nativeScanCode() const;
|
---|
243 | quint32 nativeVirtualKey() const;
|
---|
244 | quint32 nativeModifiers() const;
|
---|
245 |
|
---|
246 | #ifdef QT3_SUPPORT
|
---|
247 | inline QT3_SUPPORT_CONSTRUCTOR QKeyEvent(Type type, int key, int /*ascii*/,
|
---|
248 | int modifiers, const QString& text = QString(),
|
---|
249 | bool autorep = false, ushort count = 1)
|
---|
250 | : QInputEvent(type, Qt::KeyboardModifiers(modifiers & (int)Qt::KeyButtonMask)), txt(text), k(key),
|
---|
251 | c(count), autor(autorep)
|
---|
252 | {
|
---|
253 | if (key >= Qt::Key_Back && key <= Qt::Key_MediaLast)
|
---|
254 | ignore();
|
---|
255 | }
|
---|
256 | inline QT3_SUPPORT int ascii() const
|
---|
257 | { return (txt.length() ? txt.unicode()->toLatin1() : 0); }
|
---|
258 | inline QT3_SUPPORT Qt::ButtonState state() const { return Qt::ButtonState(QInputEvent::modifiers()); }
|
---|
259 | inline QT3_SUPPORT Qt::ButtonState stateAfter() const { return Qt::ButtonState(modifiers()); }
|
---|
260 | #endif
|
---|
261 |
|
---|
262 | protected:
|
---|
263 | QString txt;
|
---|
264 | int k;
|
---|
265 | ushort c;
|
---|
266 | uint autor:1;
|
---|
267 | };
|
---|
268 |
|
---|
269 |
|
---|
270 | class Q_GUI_EXPORT QFocusEvent : public QEvent
|
---|
271 | {
|
---|
272 | public:
|
---|
273 | QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
|
---|
274 | ~QFocusEvent();
|
---|
275 |
|
---|
276 | inline bool gotFocus() const { return type() == FocusIn; }
|
---|
277 | inline bool lostFocus() const { return type() == FocusOut; }
|
---|
278 |
|
---|
279 | #ifdef QT3_SUPPORT
|
---|
280 | enum Reason { Mouse=Qt::MouseFocusReason, Tab=Qt::TabFocusReason,
|
---|
281 | Backtab=Qt::BacktabFocusReason, MenuBar=Qt::MenuBarFocusReason,
|
---|
282 | ActiveWindow=Qt::ActiveWindowFocusReason, Other=Qt::OtherFocusReason,
|
---|
283 | Popup=Qt::PopupFocusReason, Shortcut=Qt::ShortcutFocusReason };
|
---|
284 | #endif
|
---|
285 | Qt::FocusReason reason();
|
---|
286 | Qt::FocusReason reason() const;
|
---|
287 |
|
---|
288 | private:
|
---|
289 | Qt::FocusReason m_reason;
|
---|
290 | };
|
---|
291 |
|
---|
292 |
|
---|
293 | class Q_GUI_EXPORT QPaintEvent : public QEvent
|
---|
294 | {
|
---|
295 | public:
|
---|
296 | QPaintEvent(const QRegion& paintRegion);
|
---|
297 | QPaintEvent(const QRect &paintRect);
|
---|
298 | ~QPaintEvent();
|
---|
299 |
|
---|
300 | inline const QRect &rect() const { return m_rect; }
|
---|
301 | inline const QRegion ®ion() const { return m_region; }
|
---|
302 |
|
---|
303 | #ifdef QT3_SUPPORT
|
---|
304 | QT3_SUPPORT_CONSTRUCTOR QPaintEvent(const QRegion &paintRegion, const QRect &paintRect);
|
---|
305 | inline QT3_SUPPORT bool erased() const { return m_erased; }
|
---|
306 | inline QT3_SUPPORT void setErased(bool b) { m_erased = b; }
|
---|
307 | #endif
|
---|
308 |
|
---|
309 | protected:
|
---|
310 | friend class QApplication;
|
---|
311 | friend class QCoreApplication;
|
---|
312 | QRect m_rect;
|
---|
313 | QRegion m_region;
|
---|
314 | bool m_erased;
|
---|
315 | };
|
---|
316 |
|
---|
317 | class QUpdateLaterEvent : public QEvent
|
---|
318 | {
|
---|
319 | public:
|
---|
320 | QUpdateLaterEvent(const QRegion& paintRegion);
|
---|
321 | ~QUpdateLaterEvent();
|
---|
322 |
|
---|
323 | inline const QRegion ®ion() const { return m_region; }
|
---|
324 |
|
---|
325 | protected:
|
---|
326 | QRegion m_region;
|
---|
327 | };
|
---|
328 |
|
---|
329 | class Q_GUI_EXPORT QMoveEvent : public QEvent
|
---|
330 | {
|
---|
331 | public:
|
---|
332 | QMoveEvent(const QPoint &pos, const QPoint &oldPos);
|
---|
333 | ~QMoveEvent();
|
---|
334 |
|
---|
335 | inline const QPoint &pos() const { return p; }
|
---|
336 | inline const QPoint &oldPos() const { return oldp;}
|
---|
337 | protected:
|
---|
338 | QPoint p, oldp;
|
---|
339 | friend class QApplication;
|
---|
340 | friend class QCoreApplication;
|
---|
341 | };
|
---|
342 |
|
---|
343 |
|
---|
344 | class Q_GUI_EXPORT QResizeEvent : public QEvent
|
---|
345 | {
|
---|
346 | public:
|
---|
347 | QResizeEvent(const QSize &size, const QSize &oldSize);
|
---|
348 | ~QResizeEvent();
|
---|
349 |
|
---|
350 | inline const QSize &size() const { return s; }
|
---|
351 | inline const QSize &oldSize()const { return olds;}
|
---|
352 | protected:
|
---|
353 | QSize s, olds;
|
---|
354 | friend class QApplication;
|
---|
355 | friend class QCoreApplication;
|
---|
356 | };
|
---|
357 |
|
---|
358 |
|
---|
359 | class Q_GUI_EXPORT QCloseEvent : public QEvent
|
---|
360 | {
|
---|
361 | public:
|
---|
362 | QCloseEvent();
|
---|
363 | ~QCloseEvent();
|
---|
364 | };
|
---|
365 |
|
---|
366 |
|
---|
367 | class Q_GUI_EXPORT QIconDragEvent : public QEvent
|
---|
368 | {
|
---|
369 | public:
|
---|
370 | QIconDragEvent();
|
---|
371 | ~QIconDragEvent();
|
---|
372 | };
|
---|
373 |
|
---|
374 |
|
---|
375 | class Q_GUI_EXPORT QShowEvent : public QEvent
|
---|
376 | {
|
---|
377 | public:
|
---|
378 | QShowEvent();
|
---|
379 | ~QShowEvent();
|
---|
380 | };
|
---|
381 |
|
---|
382 |
|
---|
383 | class Q_GUI_EXPORT QHideEvent : public QEvent
|
---|
384 | {
|
---|
385 | public:
|
---|
386 | QHideEvent();
|
---|
387 | ~QHideEvent();
|
---|
388 | };
|
---|
389 |
|
---|
390 | #ifndef QT_NO_CONTEXTMENU
|
---|
391 | class Q_GUI_EXPORT QContextMenuEvent : public QInputEvent
|
---|
392 | {
|
---|
393 | public:
|
---|
394 | enum Reason { Mouse, Keyboard, Other };
|
---|
395 |
|
---|
396 | QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos,
|
---|
397 | Qt::KeyboardModifiers modifiers);
|
---|
398 | QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos);
|
---|
399 | QContextMenuEvent(Reason reason, const QPoint &pos);
|
---|
400 | ~QContextMenuEvent();
|
---|
401 |
|
---|
402 | inline int x() const { return p.x(); }
|
---|
403 | inline int y() const { return p.y(); }
|
---|
404 | inline int globalX() const { return gp.x(); }
|
---|
405 | inline int globalY() const { return gp.y(); }
|
---|
406 |
|
---|
407 | inline const QPoint& pos() const { return p; }
|
---|
408 | inline const QPoint& globalPos() const { return gp; }
|
---|
409 |
|
---|
410 | inline Reason reason() const { return Reason(reas); }
|
---|
411 |
|
---|
412 | #ifdef QT3_SUPPORT
|
---|
413 | QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, int);
|
---|
414 | QT3_SUPPORT_CONSTRUCTOR QContextMenuEvent(Reason reason, const QPoint &pos, int);
|
---|
415 |
|
---|
416 | QT3_SUPPORT Qt::ButtonState state() const;
|
---|
417 | #endif
|
---|
418 | protected:
|
---|
419 | QPoint p;
|
---|
420 | QPoint gp;
|
---|
421 | uint reas : 8;
|
---|
422 | };
|
---|
423 | #endif // QT_NO_CONTEXTMENU
|
---|
424 |
|
---|
425 | #ifndef QT_NO_INPUTMETHOD
|
---|
426 | class Q_GUI_EXPORT QInputMethodEvent : public QEvent
|
---|
427 | {
|
---|
428 | public:
|
---|
429 | enum AttributeType {
|
---|
430 | TextFormat,
|
---|
431 | Cursor,
|
---|
432 | Language,
|
---|
433 | Ruby,
|
---|
434 | Selection
|
---|
435 | };
|
---|
436 | class Attribute {
|
---|
437 | public:
|
---|
438 | Attribute(AttributeType t, int s, int l, QVariant val) : type(t), start(s), length(l), value(val) {}
|
---|
439 | AttributeType type;
|
---|
440 |
|
---|
441 | int start;
|
---|
442 | int length;
|
---|
443 | QVariant value;
|
---|
444 | };
|
---|
445 | QInputMethodEvent();
|
---|
446 | QInputMethodEvent(const QString &preeditText, const QList<Attribute> &attributes);
|
---|
447 | void setCommitString(const QString &commitString, int replaceFrom = 0, int replaceLength = 0);
|
---|
448 |
|
---|
449 | inline const QList<Attribute> &attributes() const { return attrs; }
|
---|
450 | inline const QString &preeditString() const { return preedit; }
|
---|
451 |
|
---|
452 | inline const QString &commitString() const { return commit; }
|
---|
453 | inline int replacementStart() const { return replace_from; }
|
---|
454 | inline int replacementLength() const { return replace_length; }
|
---|
455 |
|
---|
456 | QInputMethodEvent(const QInputMethodEvent &other);
|
---|
457 |
|
---|
458 | private:
|
---|
459 | QString preedit;
|
---|
460 | QList<Attribute> attrs;
|
---|
461 | QString commit;
|
---|
462 | int replace_from;
|
---|
463 | int replace_length;
|
---|
464 | };
|
---|
465 | #endif // QT_NO_INPUTMETHOD
|
---|
466 |
|
---|
467 | #ifndef QT_NO_DRAGANDDROP
|
---|
468 |
|
---|
469 | class QMimeData;
|
---|
470 |
|
---|
471 | class Q_GUI_EXPORT QDropEvent : public QEvent
|
---|
472 | // QT3_SUPPORT
|
---|
473 | , public QMimeSource
|
---|
474 | // END QT3_SUPPORT
|
---|
475 | {
|
---|
476 | public:
|
---|
477 | QDropEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
|
---|
478 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop);
|
---|
479 | ~QDropEvent();
|
---|
480 |
|
---|
481 | inline const QPoint &pos() const { return p; }
|
---|
482 | inline Qt::MouseButtons mouseButtons() const { return mouseState; }
|
---|
483 | inline Qt::KeyboardModifiers keyboardModifiers() const { return modState; }
|
---|
484 |
|
---|
485 | inline Qt::DropActions possibleActions() const { return act; }
|
---|
486 | inline Qt::DropAction proposedAction() const { return default_action; }
|
---|
487 | inline void acceptProposedAction() { drop_action = default_action; accept(); }
|
---|
488 |
|
---|
489 | inline Qt::DropAction dropAction() const { return drop_action; }
|
---|
490 | void setDropAction(Qt::DropAction action);
|
---|
491 |
|
---|
492 | QWidget* source() const;
|
---|
493 | inline const QMimeData *mimeData() const { return mdata; }
|
---|
494 |
|
---|
495 | // QT3_SUPPORT
|
---|
496 | const char* format(int n = 0) const;
|
---|
497 | QByteArray encodedData(const char*) const;
|
---|
498 | bool provides(const char*) const;
|
---|
499 | // END QT3_SUPPORT
|
---|
500 | #ifdef QT3_SUPPORT
|
---|
501 | inline void accept() { QEvent::accept(); }
|
---|
502 | inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
|
---|
503 | inline QT3_SUPPORT QByteArray data(const char* f) const { return encodedData(f); }
|
---|
504 |
|
---|
505 | enum Action { Copy, Link, Move, Private, UserAction = Private };
|
---|
506 | QT3_SUPPORT Action action() const;
|
---|
507 | inline QT3_SUPPORT void acceptAction(bool y = true) { if (y) { drop_action = default_action; accept(); } }
|
---|
508 | inline QT3_SUPPORT void setPoint(const QPoint& np) { p = np; }
|
---|
509 | #endif
|
---|
510 |
|
---|
511 |
|
---|
512 | protected:
|
---|
513 | friend class QApplication;
|
---|
514 | QPoint p;
|
---|
515 | Qt::MouseButtons mouseState;
|
---|
516 | Qt::KeyboardModifiers modState;
|
---|
517 | Qt::DropActions act;
|
---|
518 | Qt::DropAction drop_action;
|
---|
519 | Qt::DropAction default_action;
|
---|
520 | const QMimeData *mdata;
|
---|
521 | mutable QList<QByteArray> fmts; // only used for QT3_SUPPORT
|
---|
522 | };
|
---|
523 |
|
---|
524 |
|
---|
525 | class Q_GUI_EXPORT QDragMoveEvent : public QDropEvent
|
---|
526 | {
|
---|
527 | public:
|
---|
528 | QDragMoveEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
|
---|
529 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = DragMove);
|
---|
530 | ~QDragMoveEvent();
|
---|
531 |
|
---|
532 | inline QRect answerRect() const { return rect; }
|
---|
533 |
|
---|
534 | inline void accept() { QDropEvent::accept(); }
|
---|
535 | inline void ignore() { QDropEvent::ignore(); }
|
---|
536 |
|
---|
537 | inline void accept(const QRect & r) { accept(); rect = r; }
|
---|
538 | inline void ignore(const QRect & r) { ignore(); rect = r; }
|
---|
539 |
|
---|
540 | #ifdef QT3_SUPPORT
|
---|
541 | inline QT3_SUPPORT void accept(bool y) { setAccepted(y); }
|
---|
542 | #endif
|
---|
543 |
|
---|
544 | protected:
|
---|
545 | friend class QApplication;
|
---|
546 | QRect rect;
|
---|
547 | };
|
---|
548 |
|
---|
549 |
|
---|
550 | class Q_GUI_EXPORT QDragEnterEvent : public QDragMoveEvent
|
---|
551 | {
|
---|
552 | public:
|
---|
553 | QDragEnterEvent(const QPoint &pos, Qt::DropActions actions, const QMimeData *data,
|
---|
554 | Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
|
---|
555 | ~QDragEnterEvent();
|
---|
556 | };
|
---|
557 |
|
---|
558 |
|
---|
559 | /* An internal class */
|
---|
560 | class Q_GUI_EXPORT QDragResponseEvent : public QEvent
|
---|
561 | {
|
---|
562 | public:
|
---|
563 | QDragResponseEvent(bool accepted);
|
---|
564 | ~QDragResponseEvent();
|
---|
565 |
|
---|
566 | inline bool dragAccepted() const { return a; }
|
---|
567 | protected:
|
---|
568 | bool a;
|
---|
569 | };
|
---|
570 |
|
---|
571 |
|
---|
572 | class Q_GUI_EXPORT QDragLeaveEvent : public QEvent
|
---|
573 | {
|
---|
574 | public:
|
---|
575 | QDragLeaveEvent();
|
---|
576 | ~QDragLeaveEvent();
|
---|
577 | };
|
---|
578 | #endif // QT_NO_DRAGANDDROP
|
---|
579 |
|
---|
580 |
|
---|
581 | class Q_GUI_EXPORT QHelpEvent : public QEvent
|
---|
582 | {
|
---|
583 | public:
|
---|
584 | QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos);
|
---|
585 | ~QHelpEvent();
|
---|
586 |
|
---|
587 | inline int x() const { return p.x(); }
|
---|
588 | inline int y() const { return p.y(); }
|
---|
589 | inline int globalX() const { return gp.x(); }
|
---|
590 | inline int globalY() const { return gp.y(); }
|
---|
591 |
|
---|
592 | inline const QPoint& pos() const { return p; }
|
---|
593 | inline const QPoint& globalPos() const { return gp; }
|
---|
594 |
|
---|
595 | private:
|
---|
596 | QPoint p;
|
---|
597 | QPoint gp;
|
---|
598 | };
|
---|
599 |
|
---|
600 | #ifndef QT_NO_STATUSTIP
|
---|
601 | class Q_GUI_EXPORT QStatusTipEvent : public QEvent
|
---|
602 | {
|
---|
603 | public:
|
---|
604 | QStatusTipEvent(const QString &tip);
|
---|
605 | ~QStatusTipEvent();
|
---|
606 |
|
---|
607 | inline QString tip() const { return s; }
|
---|
608 | private:
|
---|
609 | QString s;
|
---|
610 | };
|
---|
611 | #endif
|
---|
612 |
|
---|
613 | #ifndef QT_NO_WHATSTHIS
|
---|
614 | class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
|
---|
615 | {
|
---|
616 | public:
|
---|
617 | QWhatsThisClickedEvent(const QString &href);
|
---|
618 | ~QWhatsThisClickedEvent();
|
---|
619 |
|
---|
620 | inline QString href() const { return s; }
|
---|
621 | private:
|
---|
622 | QString s;
|
---|
623 | };
|
---|
624 | #endif
|
---|
625 |
|
---|
626 | #ifndef QT_NO_ACTION
|
---|
627 | class Q_GUI_EXPORT QActionEvent : public QEvent
|
---|
628 | {
|
---|
629 | QAction *act, *bef;
|
---|
630 | public:
|
---|
631 | QActionEvent(int type, QAction *action, QAction *before = 0);
|
---|
632 | ~QActionEvent();
|
---|
633 |
|
---|
634 | inline QAction *action() const { return act; }
|
---|
635 | inline QAction *before() const { return bef; }
|
---|
636 | };
|
---|
637 | #endif
|
---|
638 |
|
---|
639 | class Q_GUI_EXPORT QFileOpenEvent : public QEvent
|
---|
640 | {
|
---|
641 | public:
|
---|
642 | QFileOpenEvent(const QString &file);
|
---|
643 | QFileOpenEvent(const QUrl &url);
|
---|
644 | ~QFileOpenEvent();
|
---|
645 |
|
---|
646 | inline QString file() const { return f; }
|
---|
647 | QUrl url() const;
|
---|
648 | private:
|
---|
649 | QString f;
|
---|
650 | };
|
---|
651 |
|
---|
652 | #ifndef QT_NO_TOOLBAR
|
---|
653 | class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
|
---|
654 | {
|
---|
655 | public:
|
---|
656 | QToolBarChangeEvent(bool t);
|
---|
657 | ~QToolBarChangeEvent();
|
---|
658 |
|
---|
659 | inline bool toggle() const { return tog; }
|
---|
660 | private:
|
---|
661 | uint tog : 1;
|
---|
662 | };
|
---|
663 | #endif
|
---|
664 |
|
---|
665 | #ifndef QT_NO_SHORTCUT
|
---|
666 | class Q_GUI_EXPORT QShortcutEvent : public QEvent
|
---|
667 | {
|
---|
668 | public:
|
---|
669 | QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
|
---|
670 | ~QShortcutEvent();
|
---|
671 |
|
---|
672 | inline const QKeySequence &key() { return sequence; }
|
---|
673 | inline const QKeySequence &key() const { return sequence; }
|
---|
674 | inline int shortcutId() { return sid; }
|
---|
675 | inline int shortcutId() const { return sid; }
|
---|
676 | inline bool isAmbiguous() { return ambig; }
|
---|
677 | inline bool isAmbiguous() const { return ambig; }
|
---|
678 | protected:
|
---|
679 | QKeySequence sequence;
|
---|
680 | bool ambig;
|
---|
681 | int sid;
|
---|
682 | };
|
---|
683 | #endif
|
---|
684 |
|
---|
685 | #ifndef QT_NO_CLIPBOARD
|
---|
686 | class Q_GUI_EXPORT QClipboardEvent : public QEvent
|
---|
687 | {
|
---|
688 | public:
|
---|
689 | QClipboardEvent(QEventPrivate *data);
|
---|
690 | ~QClipboardEvent();
|
---|
691 |
|
---|
692 | QEventPrivate *data() { return d; }
|
---|
693 | };
|
---|
694 | #endif
|
---|
695 |
|
---|
696 | class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
|
---|
697 | {
|
---|
698 | public:
|
---|
699 | QWindowStateChangeEvent(Qt::WindowStates aOldState);
|
---|
700 | QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
|
---|
701 | ~QWindowStateChangeEvent();
|
---|
702 |
|
---|
703 | inline Qt::WindowStates oldState() const { return ostate; }
|
---|
704 | bool isOverride() const;
|
---|
705 |
|
---|
706 | private:
|
---|
707 | Qt::WindowStates ostate;
|
---|
708 | };
|
---|
709 |
|
---|
710 | #ifdef QT3_SUPPORT
|
---|
711 | class QMenuBar;
|
---|
712 | class Q_GUI_EXPORT QMenubarUpdatedEvent: public QEvent
|
---|
713 | {
|
---|
714 | public:
|
---|
715 | QMenubarUpdatedEvent(QMenuBar * const menBar);
|
---|
716 | inline QMenuBar *menuBar() { return m_menuBar; }
|
---|
717 | private:
|
---|
718 | QMenuBar *m_menuBar;
|
---|
719 | };
|
---|
720 | #endif
|
---|
721 |
|
---|
722 | #ifndef QT_NO_DEBUG_STREAM
|
---|
723 | Q_GUI_EXPORT QDebug operator<<(QDebug, const QEvent *);
|
---|
724 | #endif
|
---|
725 |
|
---|
726 | #ifndef QT_NO_SHORTCUT
|
---|
727 | inline bool operator==(QKeyEvent *e, QKeySequence::StandardKey key){return (e ? e->matches(key) : false);}
|
---|
728 | inline bool operator==(QKeySequence::StandardKey key, QKeyEvent *e){return (e ? e->matches(key) : false);}
|
---|
729 | #endif // QT_NO_SHORTCUT
|
---|
730 |
|
---|
731 | class QTouchEventTouchPointPrivate;
|
---|
732 | class Q_GUI_EXPORT QTouchEvent : public QInputEvent
|
---|
733 | {
|
---|
734 | public:
|
---|
735 | class Q_GUI_EXPORT TouchPoint
|
---|
736 | {
|
---|
737 | public:
|
---|
738 | TouchPoint(int id = -1);
|
---|
739 | TouchPoint(const QTouchEvent::TouchPoint &other);
|
---|
740 | ~TouchPoint();
|
---|
741 |
|
---|
742 | int id() const;
|
---|
743 |
|
---|
744 | Qt::TouchPointState state() const;
|
---|
745 | bool isPrimary() const;
|
---|
746 |
|
---|
747 | QPointF pos() const;
|
---|
748 | QPointF startPos() const;
|
---|
749 | QPointF lastPos() const;
|
---|
750 |
|
---|
751 | QPointF scenePos() const;
|
---|
752 | QPointF startScenePos() const;
|
---|
753 | QPointF lastScenePos() const;
|
---|
754 |
|
---|
755 | QPointF screenPos() const;
|
---|
756 | QPointF startScreenPos() const;
|
---|
757 | QPointF lastScreenPos() const;
|
---|
758 |
|
---|
759 | QPointF normalizedPos() const;
|
---|
760 | QPointF startNormalizedPos() const;
|
---|
761 | QPointF lastNormalizedPos() const;
|
---|
762 |
|
---|
763 | QRectF rect() const;
|
---|
764 | QRectF sceneRect() const;
|
---|
765 | QRectF screenRect() const;
|
---|
766 |
|
---|
767 | qreal pressure() const;
|
---|
768 |
|
---|
769 | // internal
|
---|
770 | void setId(int id);
|
---|
771 | void setState(Qt::TouchPointStates state);
|
---|
772 | void setPos(const QPointF &pos);
|
---|
773 | void setScenePos(const QPointF &scenePos);
|
---|
774 | void setScreenPos(const QPointF &screenPos);
|
---|
775 | void setNormalizedPos(const QPointF &normalizedPos);
|
---|
776 | void setStartPos(const QPointF &startPos);
|
---|
777 | void setStartScenePos(const QPointF &startScenePos);
|
---|
778 | void setStartScreenPos(const QPointF &startScreenPos);
|
---|
779 | void setStartNormalizedPos(const QPointF &startNormalizedPos);
|
---|
780 | void setLastPos(const QPointF &lastPos);
|
---|
781 | void setLastScenePos(const QPointF &lastScenePos);
|
---|
782 | void setLastScreenPos(const QPointF &lastScreenPos);
|
---|
783 | void setLastNormalizedPos(const QPointF &lastNormalizedPos);
|
---|
784 | void setRect(const QRectF &rect);
|
---|
785 | void setSceneRect(const QRectF &sceneRect);
|
---|
786 | void setScreenRect(const QRectF &screenRect);
|
---|
787 | void setPressure(qreal pressure);
|
---|
788 | QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
|
---|
789 |
|
---|
790 | private:
|
---|
791 | QTouchEventTouchPointPrivate *d;
|
---|
792 | friend class QApplication;
|
---|
793 | friend class QApplicationPrivate;
|
---|
794 | };
|
---|
795 |
|
---|
796 | enum DeviceType {
|
---|
797 | TouchScreen,
|
---|
798 | TouchPad
|
---|
799 | };
|
---|
800 |
|
---|
801 | QTouchEvent(QEvent::Type eventType,
|
---|
802 | QTouchEvent::DeviceType deviceType = TouchScreen,
|
---|
803 | Qt::KeyboardModifiers modifiers = Qt::NoModifier,
|
---|
804 | Qt::TouchPointStates touchPointStates = 0,
|
---|
805 | const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
|
---|
806 | ~QTouchEvent();
|
---|
807 |
|
---|
808 | inline QWidget *widget() const { return _widget; }
|
---|
809 | inline QTouchEvent::DeviceType deviceType() const { return _deviceType; }
|
---|
810 | inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
|
---|
811 | inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
|
---|
812 |
|
---|
813 | // internal
|
---|
814 | inline void setWidget(QWidget *awidget) { _widget = awidget; }
|
---|
815 | inline void setDeviceType(DeviceType adeviceType) { _deviceType = adeviceType; }
|
---|
816 | inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
|
---|
817 | inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
|
---|
818 |
|
---|
819 | protected:
|
---|
820 | QWidget *_widget;
|
---|
821 | QTouchEvent::DeviceType _deviceType;
|
---|
822 | Qt::TouchPointStates _touchPointStates;
|
---|
823 | QList<QTouchEvent::TouchPoint> _touchPoints;
|
---|
824 |
|
---|
825 | friend class QApplication;
|
---|
826 | friend class QApplicationPrivate;
|
---|
827 | };
|
---|
828 |
|
---|
829 | #ifndef QT_NO_GESTURES
|
---|
830 | class QGesture;
|
---|
831 | class QGestureEventPrivate;
|
---|
832 | class Q_GUI_EXPORT QGestureEvent : public QEvent
|
---|
833 | {
|
---|
834 | public:
|
---|
835 | QGestureEvent(const QList<QGesture *> &gestures);
|
---|
836 | ~QGestureEvent();
|
---|
837 |
|
---|
838 | QList<QGesture *> gestures() const;
|
---|
839 | QGesture *gesture(Qt::GestureType type) const;
|
---|
840 |
|
---|
841 | QList<QGesture *> activeGestures() const;
|
---|
842 | QList<QGesture *> canceledGestures() const;
|
---|
843 |
|
---|
844 | #ifdef Q_NO_USING_KEYWORD
|
---|
845 | inline void setAccepted(bool accepted) { QEvent::setAccepted(accepted); }
|
---|
846 | inline bool isAccepted() const { return QEvent::isAccepted(); }
|
---|
847 |
|
---|
848 | inline void accept() { QEvent::accept(); }
|
---|
849 | inline void ignore() { QEvent::ignore(); }
|
---|
850 | #else
|
---|
851 | using QEvent::setAccepted;
|
---|
852 | using QEvent::isAccepted;
|
---|
853 | using QEvent::accept;
|
---|
854 | using QEvent::ignore;
|
---|
855 | #endif
|
---|
856 |
|
---|
857 | void setAccepted(QGesture *, bool);
|
---|
858 | void accept(QGesture *);
|
---|
859 | void ignore(QGesture *);
|
---|
860 | bool isAccepted(QGesture *) const;
|
---|
861 |
|
---|
862 | void setAccepted(Qt::GestureType, bool);
|
---|
863 | void accept(Qt::GestureType);
|
---|
864 | void ignore(Qt::GestureType);
|
---|
865 | bool isAccepted(Qt::GestureType) const;
|
---|
866 |
|
---|
867 | void setWidget(QWidget *widget);
|
---|
868 | QWidget *widget() const;
|
---|
869 |
|
---|
870 | #ifndef QT_NO_GRAPHICSVIEW
|
---|
871 | QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
|
---|
872 | #endif
|
---|
873 |
|
---|
874 | private:
|
---|
875 | QGestureEventPrivate *d_func();
|
---|
876 | const QGestureEventPrivate *d_func() const;
|
---|
877 |
|
---|
878 | friend class QApplication;
|
---|
879 | friend class QGestureManager;
|
---|
880 | };
|
---|
881 | #endif // QT_NO_GESTURES
|
---|
882 |
|
---|
883 | QT_END_NAMESPACE
|
---|
884 |
|
---|
885 | QT_END_HEADER
|
---|
886 |
|
---|
887 | #endif // QEVENT_H
|
---|