Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qevent.cpp
Go to the documentation of this file.
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
4#include "qevent.h"
5#include "qcursor.h"
6#include "private/qguiapplication_p.h"
7#include "private/qinputdevice_p.h"
8#include "private/qpointingdevice_p.h"
9#include "qpa/qplatformintegration.h"
10#include "private/qevent_p.h"
11#include "private/qeventpoint_p.h"
12#include "qfile.h"
13#include "qhashfunctions.h"
14#include "qmetaobject.h"
15#include "qmimedata.h"
16#include "qevent_p.h"
17#include "qmath.h"
18#include "qloggingcategory.h"
19
20#if QT_CONFIG(draganddrop)
21#include <qpa/qplatformdrag.h>
22#include <private/qdnd_p.h>
23#endif
24
25#if QT_CONFIG(shortcut)
26#include <private/qshortcut_p.h>
27#endif
28
29#include <private/qdebug_p.h>
30
31#define Q_IMPL_POINTER_EVENT(Class) \
32 Class::Class(const Class &) = default; \
33 Class::~Class() = default; \
34 Class* Class::clone() const \
35 { \
36 auto c = new Class(*this); \
37 for (auto &point : c->m_points) \
38 QMutableEventPoint::detach(point); \
39 QEvent *e = c; \
40 /* check that covariant return is safe to add */ \
41 Q_ASSERT(reinterpret_cast<quintptr>(c) == reinterpret_cast<quintptr>(e)); \
42 return c; \
43 }
44
45
46
48
49static_assert(sizeof(QMutableTouchEvent) == sizeof(QTouchEvent));
50static_assert(sizeof(QMutableSinglePointEvent) == sizeof(QSinglePointEvent));
51static_assert(sizeof(QMouseEvent) == sizeof(QSinglePointEvent));
52static_assert(sizeof(QVector2D) == sizeof(quint64));
53
73QEnterEvent::QEnterEvent(const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, const QPointingDevice *device)
74 : QSinglePointEvent(QEvent::Enter, device, localPos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier)
75{
76}
77
79
80
147QInputEvent::QInputEvent(Type type, const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
148 : QEvent(type, QEvent::InputEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
149{}
150
155 : QEvent(type, QEvent::PointerEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
156{}
157
162 : QEvent(type, QEvent::SinglePointEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
163{}
164
166
167
238{
239 return m_points[i];
240}
241
258 Qt::KeyboardModifiers modifiers, const QList<QEventPoint> &points)
259 : QInputEvent(type, QEvent::PointerEventTag{}, dev, modifiers), m_points(points)
260{
261}
262
267 : QInputEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers)
268{
269}
270
272
278{
279 for (auto &p : m_points) {
280 if (p.id() == id)
281 return &p;
282 }
283 return nullptr;
284}
285
291{
292 for (const auto &p : points()) {
294 return false;
295 }
296 return true;
297}
298
304{
305 for (const auto &p : points()) {
306 if (!p.isAccepted())
307 return false;
308 }
309 return true;
310}
311
315void QPointerEvent::setAccepted(bool accepted)
316{
317 QEvent::setAccepted(accepted);
318 for (auto &p : m_points)
319 p.setAccepted(accepted);
320}
321
328{
329 return static_cast<const QPointingDevice *>(m_dev);
330}
331
336{
338 for (auto &p : m_points)
340}
341
349{
352 if (Q_UNLIKELY(!persistentPoint)) {
353 qWarning() << "point is not in activePoints" << point;
354 return nullptr;
355 }
356 return persistentPoint->exclusiveGrabber;
357}
358
366void QPointerEvent::setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber)
367{
369 auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
370 devPriv->setExclusiveGrabber(this, point, exclusiveGrabber);
371}
372
382{
385 if (Q_UNLIKELY(!persistentPoint)) {
386 qWarning() << "point is not in activePoints" << point;
387 return {};
388 }
389 return persistentPoint->passiveGrabbers;
390}
391
402{
404 auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
405 return devPriv->addPassiveGrabber(this, point, grabber);
406}
407
417{
419 auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
420 return devPriv->removePassiveGrabber(this, point, grabber);
421}
422
431{
433 auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
434 devPriv->clearPassiveGrabbers(this, point);
435}
436
513 const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos,
514 Qt::MouseButton button, Qt::MouseButtons buttons,
515 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
516 : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
517 m_button(button),
518 m_mouseState(buttons),
519 m_source(source),
520 m_reserved(0), m_reserved2(0),
521 m_doubleClick(false), m_phase(0), m_invertedScrolling(0)
522{
523 bool isPress = (button != Qt::NoButton && (button | buttons) == buttons);
524 bool isWheel = (type == QEvent::Type::Wheel);
525 auto devPriv = QPointingDevicePrivate::get(const_cast<QPointingDevice *>(pointingDevice()));
526 auto epd = devPriv->pointById(0);
527 QEventPoint &p = epd->eventPoint;
528 Q_ASSERT(p.device() == dev);
529 // p is a reference to a non-detached instance that lives in QPointingDevicePrivate::activePoints.
530 // Update persistent info in that instance.
531 if (isPress || isWheel)
532 QMutableEventPoint::setGlobalLastPosition(p, globalPos);
533 else
534 QMutableEventPoint::setGlobalLastPosition(p, p.globalPosition());
535 QMutableEventPoint::setGlobalPosition(p, globalPos);
536 if (isWheel && p.state() != QEventPoint::State::Updated)
537 QMutableEventPoint::setGlobalPressPosition(p, globalPos);
539 QMutableEventPoint::setState(p, QEventPoint::State::Stationary);
540 else if (button == Qt::NoButton || isWheel)
541 QMutableEventPoint::setState(p, QEventPoint::State::Updated);
542 else if (isPress)
543 QMutableEventPoint::setState(p, QEventPoint::State::Pressed);
544 else
545 QMutableEventPoint::setState(p, QEventPoint::State::Released);
546 QMutableEventPoint::setScenePosition(p, scenePos);
547 // Now detach, and update the detached instance with ephemeral state.
549 QMutableEventPoint::setPosition(p, localPos);
551}
552
562 Qt::MouseButton button, Qt::MouseButtons buttons,
563 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
564 : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
565 m_button(button),
566 m_mouseState(buttons),
567 m_source(source),
568 m_reserved(0), m_reserved2(0),
569 m_doubleClick(false), m_phase(0), m_invertedScrolling(0)
570{
571 m_points << point;
572}
573
575
576
579bool QSinglePointEvent::isBeginEvent() const
580{
581 // A double-click event does not begin a sequence: it comes after a press event,
582 // and while it tells which button caused the double-click, it doesn't represent
583 // a change of button state. So it's an update event.
584 return m_button != Qt::NoButton && m_mouseState.testFlag(m_button)
586}
587
592{
593 // A double-click event is an update event even though it tells which button
594 // caused the double-click, because a MouseButtonPress event was sent right before it.
596}
597
602{
603 return m_button != Qt::NoButton && !m_mouseState.testFlag(m_button);
604}
605
669#if QT_DEPRECATED_SINCE(6, 4)
693 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
694 : QSinglePointEvent(type, device, localPos, localPos,
695#ifdef QT_NO_CURSOR
696 localPos,
697#else
698 QCursor::pos(),
699#endif
700 button, buttons, modifiers)
701{
702}
703#endif
704
723QMouseEvent::QMouseEvent(Type type, const QPointF &localPos, const QPointF &globalPos,
724 Qt::MouseButton button, Qt::MouseButtons buttons,
725 Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
726 : QMouseEvent(type, localPos, localPos, globalPos, button, buttons, modifiers, device)
727{
728}
729
748 const QPointF &scenePos, const QPointF &globalPos,
749 Qt::MouseButton button, Qt::MouseButtons buttons,
750 Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
751 : QSinglePointEvent(type, device, localPos, scenePos, globalPos, button, buttons, modifiers)
752{
753}
754
755QMouseEvent::QMouseEvent(QEvent::Type type, const QPointF &localPos, const QPointF &windowPos,
756 const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons,
757 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source,
758 const QPointingDevice *device)
759 : QSinglePointEvent(type, device, localPos, windowPos, globalPos, button, buttons, modifiers, source)
760{
761}
762
764
765
795// Note: the docs mention 6.0 as a deprecation version. That is correct and
796// intended, because we want our users to stop using it! Internally we will
797// deprecate it when we port our code away from using it.
798Qt::MouseEventSource QMouseEvent::source() const
799{
800 return Qt::MouseEventSource(m_source);
801}
802
813Qt::MouseEventFlags QMouseEvent::flags() const
814{
816}
817
1054QHoverEvent::QHoverEvent(Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos,
1055 Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
1056 : QSinglePointEvent(type, device, scenePos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
1057{
1058}
1059
1060#if QT_DEPRECATED_SINCE(6, 3)
1074QHoverEvent::QHoverEvent(Type type, const QPointF &pos, const QPointF &oldPos,
1075 Qt::KeyboardModifiers modifiers, const QPointingDevice *device)
1076 : QSinglePointEvent(type, device, pos, pos, pos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
1077{
1078}
1079#endif
1080
1082
1083#if QT_CONFIG(wheelevent)
1196QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
1197 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
1198 bool inverted, Qt::MouseEventSource source, const QPointingDevice *device)
1199 : QSinglePointEvent(Wheel, device, pos, pos, globalPos, Qt::NoButton, buttons, modifiers, source),
1200 m_pixelDelta(pixelDelta), m_angleDelta(angleDelta)
1201{
1202 m_phase = phase;
1203 m_invertedScrolling = inverted;
1204}
1205
1206Q_IMPL_POINTER_EVENT(QWheelEvent)
1207
1208
1211bool QWheelEvent::isBeginEvent() const
1212{
1213 return m_phase == Qt::ScrollBegin;
1214}
1215
1219bool QWheelEvent::isUpdateEvent() const
1220{
1221 return m_phase == Qt::ScrollUpdate || m_phase == Qt::ScrollMomentum;
1222}
1223
1227bool QWheelEvent::isEndEvent() const
1228{
1229 return m_phase == Qt::ScrollEnd;
1230}
1231
1232#endif // QT_CONFIG(wheelevent)
1233
1346QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString& text,
1347 bool autorep, quint16 count)
1348 : QInputEvent(type, QInputDevice::primaryKeyboard(), modifiers), m_text(text), m_key(key),
1349 m_scanCode(0), m_virtualKey(0), m_nativeModifiers(0),
1350 m_count(count), m_autoRepeat(autorep)
1351{
1353 ignore();
1354}
1355
1374QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers,
1375 quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
1376 const QString &text, bool autorep, quint16 count, const QInputDevice *device)
1377 : QInputEvent(type, device, modifiers), m_text(text), m_key(key),
1378 m_scanCode(nativeScanCode), m_virtualKey(nativeVirtualKey), m_nativeModifiers(nativeModifiers),
1379 m_count(count), m_autoRepeat(autorep)
1380{
1382 ignore();
1383}
1384
1385
1387
1388
1465Qt::KeyboardModifiers QKeyEvent::modifiers() const
1466{
1467 if (key() == Qt::Key_Shift)
1468 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
1469 if (key() == Qt::Key_Control)
1470 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
1471 if (key() == Qt::Key_Alt)
1472 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
1473 if (key() == Qt::Key_Meta)
1474 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
1475 if (key() == Qt::Key_AltGr)
1476 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
1477 return QInputEvent::modifiers();
1478}
1479
1489#if QT_CONFIG(shortcut)
1497bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
1498{
1499 //The keypad and group switch modifier should not make a difference
1500 uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
1501
1502 const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey);
1503 return bindings.contains(QKeySequence(searchkey));
1504}
1505#endif // QT_CONFIG(shortcut)
1506
1507
1558 : QEvent(type), m_reason(reason)
1559{}
1560
1562
1563
1566Qt::FocusReason QFocusEvent::reason() const
1567{
1568 return m_reason;
1569}
1570
1622 : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(false)
1623{}
1624
1630 : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(false)
1631{}
1632
1633
1635
1636
1672QMoveEvent::QMoveEvent(const QPoint &pos, const QPoint &oldPos)
1673 : QEvent(Move), m_pos(pos), m_oldPos(oldPos)
1674{}
1675
1677
1678
1717QExposeEvent::QExposeEvent(const QRegion &exposeRegion)
1718 : QEvent(Expose)
1719 , m_region(exposeRegion)
1720{
1721}
1722
1724
1725
1762 : QEvent(PlatformSurface)
1763 , m_surfaceEventType(surfaceEventType)
1764{
1765}
1766
1768
1769
1794QResizeEvent::QResizeEvent(const QSize &size, const QSize &oldSize)
1795 : QEvent(Resize), m_size(size), m_oldSize(oldSize)
1796{}
1797
1799
1800
1866 : QEvent(Close)
1867{}
1868
1870
1871
1895 : QEvent(IconDrag)
1896{ ignore(); }
1897
1899
1900
1917#ifndef QT_NO_CONTEXTMENU
1930 Qt::KeyboardModifiers modifiers)
1931 : QInputEvent(ContextMenu, QPointingDevice::primaryPointingDevice(), modifiers), m_pos(pos), m_globalPos(globalPos), m_reason(reason)
1932{}
1933
1935
1936#if QT_DEPRECATED_SINCE(6, 4)
1953QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
1954 : QInputEvent(ContextMenu, QInputDevice::primaryKeyboard()), m_pos(pos), m_reason(reason)
1955{
1956#ifndef QT_NO_CURSOR
1958#endif
1959}
1960#endif
1961
2015#endif // QT_NO_CONTEXTMENU
2016
2231 : QEvent(QEvent::InputMethod), m_replacementStart(0), m_replacementLength(0)
2232{
2233}
2234
2246 : QEvent(QEvent::InputMethod), m_preedit(preeditText), m_attributes(attributes),
2247 m_replacementStart(0), m_replacementLength(0)
2248{
2249}
2250
2252
2253
2269void QInputMethodEvent::setCommitString(const QString &commitString, int replaceFrom, int replaceLength)
2270{
2271 m_commit = commitString;
2272 m_replacementStart = replaceFrom;
2273 m_replacementLength = replaceLength;
2274}
2275
2353 : QEvent(InputMethodQuery),
2354 m_queries(queries)
2355{
2356}
2357
2359
2360
2364{
2365 for (int i = 0; i < m_values.size(); ++i) {
2366 if (m_values.at(i).query == query) {
2367 m_values[i].value = value;
2368 return;
2369 }
2370 }
2371 QueryPair pair = { query, value };
2372 m_values.append(pair);
2373}
2374
2379{
2380 for (int i = 0; i < m_values.size(); ++i)
2381 if (m_values.at(i).query == query)
2382 return m_values.at(i).value;
2383 return QVariant();
2384}
2385
2386#if QT_CONFIG(tabletevent)
2387
2494QTabletEvent::QTabletEvent(Type type, const QPointingDevice *dev, const QPointF &pos, const QPointF &globalPos,
2495 qreal pressure, float xTilt, float yTilt,
2496 float tangentialPressure, qreal rotation, float z,
2497 Qt::KeyboardModifiers keyState,
2498 Qt::MouseButton button, Qt::MouseButtons buttons)
2499 : QSinglePointEvent(type, dev, pos, pos, globalPos, button, buttons, keyState),
2500 m_tangential(tangentialPressure),
2501 m_xTilt(xTilt),
2502 m_yTilt(yTilt),
2503 m_z(z)
2504{
2505 QEventPoint &p = point(0);
2506 QMutableEventPoint::setPressure(p, pressure);
2507 QMutableEventPoint::setRotation(p, rotation);
2508}
2509
2510Q_IMPL_POINTER_EVENT(QTabletEvent)
2511
2512
2701#endif // QT_CONFIG(tabletevent)
2702
2703#ifndef QT_NO_GESTURES
2769#if QT_DEPRECATED_SINCE(6, 2)
2787QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device,
2788 const QPointF &localPos, const QPointF &scenePos,
2789 const QPointF &globalPos, qreal realValue, quint64 sequenceId,
2790 quint64 intValue)
2791 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2793 m_sequenceId(sequenceId), m_realValue(realValue), m_gestureType(type)
2794{
2795 if (qIsNull(realValue) && intValue != 0)
2796 m_realValue = intValue;
2797}
2798#endif // deprecated
2799
2823QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPointingDevice *device, int fingerCount,
2824 const QPointF &localPos, const QPointF &scenePos,
2825 const QPointF &globalPos, qreal value, const QPointF &delta,
2826 quint64 sequenceId)
2827 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2829 m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
2830{
2831 Q_ASSERT(fingerCount < 16); // we store it in 4 bits unsigned
2832}
2833
2835
2836
2916#endif // QT_NO_GESTURES
2917
2918#if QT_CONFIG(draganddrop)
2931QDragMoveEvent::QDragMoveEvent(const QPoint& pos, Qt::DropActions actions, const QMimeData *data,
2932 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
2933 : QDropEvent(pos, actions, data, buttons, modifiers, type)
2934 , m_rect(pos, QSize(1, 1))
2935{}
2936
2937Q_IMPL_EVENT_COMMON(QDragMoveEvent)
2938
2939
3027// ### pos is in which coordinate system?
3039QDropEvent::QDropEvent(const QPointF& pos, Qt::DropActions actions, const QMimeData *data,
3040 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3041 : QEvent(type), m_pos(pos), m_mouseState(buttons),
3042 m_modState(modifiers), m_actions(actions),
3043 m_data(data)
3044{
3045 m_defaultAction = m_dropAction =
3046 QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(m_actions, modifiers);
3047 ignore();
3048}
3049
3050Q_IMPL_EVENT_COMMON(QDropEvent)
3051
3052
3053
3064QObject* QDropEvent::source() const
3065{
3067 return manager->source();
3068 return nullptr;
3069}
3070
3071
3072void QDropEvent::setDropAction(Qt::DropAction action)
3073{
3074 if (!(action & m_actions) && action != Qt::IgnoreAction)
3075 action = m_defaultAction;
3076 m_dropAction = action;
3077}
3078
3211QDragEnterEvent::QDragEnterEvent(const QPoint& point, Qt::DropActions actions, const QMimeData *data,
3212 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3213 : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
3214{}
3215
3216Q_IMPL_EVENT_COMMON(QDragEnterEvent)
3217
3218
3266QDragLeaveEvent::QDragLeaveEvent()
3267 : QEvent(DragLeave)
3268{}
3269
3270Q_IMPL_EVENT_COMMON(QDragLeaveEvent)
3271
3272#endif // QT_CONFIG(draganddrop)
3273
3300 : QEvent(type), m_pos(pos), m_globalPos(globalPos)
3301{}
3302
3354
3355#ifndef QT_NO_STATUSTIP
3356
3405 : QEvent(StatusTip), m_tip(tip)
3406{}
3407
3409
3410
3418#endif // QT_NO_STATUSTIP
3419
3420#if QT_CONFIG(whatsthis)
3421
3440QWhatsThisClickedEvent::QWhatsThisClickedEvent(const QString &href)
3441 : QEvent(WhatsThisClicked), m_href(href)
3442{}
3443
3444Q_IMPL_EVENT_COMMON(QWhatsThisClickedEvent)
3445
3446
3453#endif // QT_CONFIG(whatsthis)
3454
3455#ifndef QT_NO_ACTION
3456
3482QActionEvent::QActionEvent(int type, QAction *action, QAction *before)
3483 : QEvent(static_cast<QEvent::Type>(type)), m_action(action), m_before(before)
3484{}
3485
3487
3488
3507#endif // QT_NO_ACTION
3508
3533 : QEvent(Hide)
3534{}
3535
3537
3538
3559 : QEvent(Show)
3560{}
3561
3563
3564
3610 : QEvent(FileOpen), m_file(file), m_url(QUrl::fromLocalFile(file))
3611{
3612}
3613
3620 : QEvent(FileOpen), m_file(url.toLocalFile()), m_url(url)
3621{
3622}
3623
3625
3626
3642#if QT_DEPRECATED_SINCE(6, 6)
3655bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
3656{
3657 file.setFileName(m_file);
3658 return file.open(flags);
3659}
3660#endif
3661
3662#ifndef QT_NO_TOOLBAR
3684 : QEvent(ToolBarChange), m_toggle(t)
3685{}
3686
3688
3689
3694/*
3695 \fn Qt::ButtonState QToolBarChangeEvent::state() const
3696
3697 Returns the keyboard modifier flags at the time of the event.
3698
3699 The returned value is a selection of the following values,
3700 combined using the OR operator:
3701 Qt::ShiftButton, Qt::ControlButton, Qt::MetaButton, and Qt::AltButton.
3702*/
3703
3704#endif // QT_NO_TOOLBAR
3705
3706#if QT_CONFIG(shortcut)
3707
3717QShortcutEvent::QShortcutEvent(const QKeySequence &key, int id, bool ambiguous)
3718 : QEvent(Shortcut), m_sequence(key), m_shortcutId(id), m_ambiguous(ambiguous)
3719{
3720}
3721
3730QShortcutEvent::QShortcutEvent(const QKeySequence &key, const QShortcut *shortcut, bool ambiguous)
3731 : QEvent(Shortcut), m_sequence(key), m_shortcutId(0), m_ambiguous(ambiguous)
3732{
3733 if (shortcut) {
3734 auto priv = static_cast<const QShortcutPrivate *>(QShortcutPrivate::get(shortcut));
3735 auto index = priv->sc_sequences.indexOf(key);
3736 if (index < 0) {
3737 qWarning() << "Given QShortcut does not contain key-sequence " << key;
3738 return;
3739 }
3740 m_shortcutId = priv->sc_ids[index];
3741 }
3742}
3743
3745
3746#endif // QT_CONFIG(shortcut)
3747
3748#ifndef QT_NO_DEBUG_STREAM
3749
3750static inline void formatTouchEvent(QDebug d, const QTouchEvent &t)
3751{
3752 d << "QTouchEvent(";
3753 QtDebugUtils::formatQEnum(d, t.type());
3754 d << " device: " << t.device()->name();
3755 d << " states: ";
3756 QtDebugUtils::formatQFlags(d, t.touchPointStates());
3757 d << ", " << t.points().size() << " points: " << t.points() << ')';
3758}
3759
3761{
3762 d << '"' << Qt::hex;
3763 for (int i = 0; i < s.size(); ++i) {
3764 if (i)
3765 d << ',';
3766 d << "U+" << s.at(i).unicode();
3767 }
3768 d << Qt::dec << '"';
3769}
3770
3772{
3773 dbg << "[type= " << attr.type << ", start=" << attr.start << ", length=" << attr.length
3774 << ", value=" << attr.value << ']';
3775 return dbg;
3776}
3777
3779{
3780 d << "QInputMethodEvent(";
3781 if (!e->preeditString().isEmpty()) {
3782 d << "preedit=";
3783 formatUnicodeString(d, e->preeditString());
3784 }
3785 if (!e->commitString().isEmpty()) {
3786 d << ", commit=";
3787 formatUnicodeString(d, e->commitString());
3788 }
3789 if (e->replacementLength()) {
3790 d << ", replacementStart=" << e->replacementStart() << ", replacementLength="
3791 << e->replacementLength();
3792 }
3793 const auto attributes = e->attributes();
3794 auto it = attributes.cbegin();
3795 const auto end = attributes.cend();
3796 if (it != end) {
3797 d << ", attributes= {";
3798 d << *it;
3799 ++it;
3800 for (; it != end; ++it)
3801 d << ',' << *it;
3802 d << '}';
3803 }
3804 d << ')';
3805}
3806
3808{
3809 QDebugStateSaver saver(d);
3810 d.noquote();
3811 const Qt::InputMethodQueries queries = e->queries();
3812 d << "QInputMethodQueryEvent(queries=" << Qt::showbase << Qt::hex << int(queries)
3813 << Qt::noshowbase << Qt::dec << ", {";
3814 for (unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
3815 if (queries & mask) {
3817 const QVariant value = e->value(query);
3818 if (value.isValid()) {
3819 d << '[';
3821 d << '=';
3822 if (query == Qt::ImHints)
3823 QtDebugUtils::formatQFlags(d, Qt::InputMethodHints(value.toInt()));
3824 else
3825 d << value.toString();
3826 d << "],";
3827 }
3828 }
3829 }
3830 d << "})";
3831}
3832
3833static const char *eventClassName(QEvent::Type t)
3834{
3835 switch (t) {
3839 return "QActionEvent";
3843 case QEvent::MouseMove:
3848 return "QMouseEvent";
3849 case QEvent::DragEnter:
3850 return "QDragEnterEvent";
3851 case QEvent::DragMove:
3852 return "QDragMoveEvent";
3853 case QEvent::Drop:
3854 return "QDropEvent";
3855 case QEvent::KeyPress:
3856 case QEvent::KeyRelease:
3858 return "QKeyEvent";
3859 case QEvent::FocusIn:
3860 case QEvent::FocusOut:
3862 return "QFocusEvent";
3863 case QEvent::ChildAdded:
3866 return "QChildEvent";
3867 case QEvent::Paint:
3868 return "QPaintEvent";
3869 case QEvent::Move:
3870 return "QMoveEvent";
3871 case QEvent::Resize:
3872 return "QResizeEvent";
3873 case QEvent::Show:
3874 return "QShowEvent";
3875 case QEvent::Hide:
3876 return "QHideEvent";
3877 case QEvent::Enter:
3878 return "QEnterEvent";
3879 case QEvent::Close:
3880 return "QCloseEvent";
3881 case QEvent::FileOpen:
3882 return "QFileOpenEvent";
3883#ifndef QT_NO_GESTURES
3885 return "QNativeGestureEvent";
3886 case QEvent::Gesture:
3888 return "QGestureEvent";
3889#endif
3890 case QEvent::HoverEnter:
3891 case QEvent::HoverLeave:
3892 case QEvent::HoverMove:
3893 return "QHoverEvent";
3897 case QEvent::TabletMove:
3899 return "QTabletEvent";
3900 case QEvent::StatusTip:
3901 return "QStatusTipEvent";
3902 case QEvent::ToolTip:
3903 return "QHelpEvent";
3905 return "QWindowStateChangeEvent";
3906 case QEvent::Wheel:
3907 return "QWheelEvent";
3908 case QEvent::TouchBegin:
3910 case QEvent::TouchEnd:
3911 return "QTouchEvent";
3912 case QEvent::Shortcut:
3913 return "QShortcutEvent";
3915 return "QInputMethodEvent";
3917 return "QInputMethodQueryEvent";
3919 return "QScreenOrientationChangeEvent";
3921 return "QScrollPrepareEvent";
3922 case QEvent::Scroll:
3923 return "QScrollEvent";
3928 return "QGraphicsSceneMouseEvent";
3939 return "QGraphicsSceneEvent";
3940 case QEvent::Timer:
3941 return "QTimerEvent";
3943 return "QPlatformSurfaceEvent";
3944 default:
3945 break;
3946 }
3947 return "QEvent";
3948}
3949
3950# if QT_CONFIG(draganddrop)
3951
3952static void formatDropEvent(QDebug d, const QDropEvent *e)
3953{
3954 const QEvent::Type type = e->type();
3955 d << eventClassName(type) << "(dropAction=";
3956 QtDebugUtils::formatQEnum(d, e->dropAction());
3957 d << ", proposedAction=";
3958 QtDebugUtils::formatQEnum(d, e->proposedAction());
3959 d << ", possibleActions=";
3960 QtDebugUtils::formatQFlags(d, e->possibleActions());
3961 d << ", posF=";
3962 QtDebugUtils::formatQPoint(d, e->position());
3964 d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect();
3965 d << ", formats=" << e->mimeData()->formats();
3966 QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->modifiers());
3967 d << ", ";
3968 QtDebugUtils::formatQFlags(d, e->buttons());
3969}
3970
3971# endif // QT_CONFIG(draganddrop)
3972
3973# if QT_CONFIG(tabletevent)
3974
3975static void formatTabletEvent(QDebug d, const QTabletEvent *e)
3976{
3977 const QEvent::Type type = e->type();
3978
3979 d << eventClassName(type) << '(';
3981 d << ' ';
3982 QtDebugUtils::formatQFlags(d, e->buttons());
3983 d << " pos=";
3984 QtDebugUtils::formatQPoint(d, e->position());
3985 d << " z=" << e->z()
3986 << " xTilt=" << e->xTilt()
3987 << " yTilt=" << e->yTilt();
3989 d << " pressure=" << e->pressure();
3990 if (e->device()->hasCapability(QInputDevice::Capability::Rotation))
3991 d << " rotation=" << e->rotation();
3992 if (e->deviceType() == QInputDevice::DeviceType::Airbrush)
3993 d << " tangentialPressure=" << e->tangentialPressure();
3994 d << " dev=" << e->device() << ')';
3995}
3996
3997# endif // QT_CONFIG(tabletevent)
3998
4000{
4001 if (!tp) {
4002 dbg << "QEventPoint(0x0)";
4003 return dbg;
4004 }
4005 return operator<<(dbg, *tp);
4006}
4007
4009{
4010 QDebugStateSaver saver(dbg);
4011 dbg.nospace();
4012 dbg << "QEventPoint(id=" << tp.id() << " ts=" << tp.timestamp();
4013 dbg << " pos=";
4015 dbg << " scn=";
4017 dbg << " gbl=";
4019 dbg << ' ';
4021 if (!qFuzzyIsNull(tp.pressure()) && !qFuzzyCompare(tp.pressure(), 1))
4022 dbg << " pressure=" << tp.pressure();
4023 if (!tp.ellipseDiameters().isEmpty() || !qFuzzyIsNull(tp.rotation())) {
4024 dbg << " ellipse=("
4025 << tp.ellipseDiameters().width() << "x" << tp.ellipseDiameters().height()
4026 << " \u2221 " << tp.rotation() << ')';
4027 }
4028 dbg << " vel=";
4030 dbg << " press=";
4032 dbg << " last=";
4034 dbg << " \u0394 ";
4036 dbg << ')';
4037 return dbg;
4038}
4039
4041{
4042 QDebugStateSaver saver(dbg);
4043 dbg.nospace();
4044 if (!e) {
4045 dbg << "QEvent(this = 0x0)";
4046 return dbg;
4047 }
4048 // More useful event output could be added here
4049 const QEvent::Type type = e->type();
4050 bool isMouse = false;
4051 switch (type) {
4052 case QEvent::Expose:
4053 dbg << "QExposeEvent()";
4054 break;
4055 case QEvent::Paint:
4056 dbg << "QPaintEvent(" << static_cast<const QPaintEvent *>(e)->region() << ')';
4057 break;
4059 case QEvent::MouseMove:
4066 isMouse = true;
4067 Q_FALLTHROUGH();
4068 case QEvent::HoverEnter:
4069 case QEvent::HoverMove:
4070 case QEvent::HoverLeave:
4071 {
4072 const QSinglePointEvent *spe = static_cast<const QSinglePointEvent*>(e);
4073 const Qt::MouseButton button = spe->button();
4074 const Qt::MouseButtons buttons = spe->buttons();
4075 dbg << eventClassName(type) << '(';
4077 if (isMouse) {
4079 dbg << ' ';
4081 }
4082 if (buttons && button != buttons) {
4083 dbg << " btns=";
4084 QtDebugUtils::formatQFlags(dbg, buttons);
4085 }
4086 }
4088 dbg << " pos=";
4090 dbg << " scn=";
4092 dbg << " gbl=";
4094 dbg << " dev=" << spe->device() << ')';
4095 if (isMouse) {
4096 auto src = static_cast<const QMouseEvent*>(e)->source();
4098 dbg << " source=";
4100 }
4101 }
4102 }
4103 break;
4104# if QT_CONFIG(wheelevent)
4105 case QEvent::Wheel: {
4106 const QWheelEvent *we = static_cast<const QWheelEvent *>(e);
4107 dbg << "QWheelEvent(" << we->phase();
4108 if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
4109 dbg << ", pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta();
4110 dbg << ')';
4111 }
4112 break;
4113# endif // QT_CONFIG(wheelevent)
4114 case QEvent::KeyPress:
4115 case QEvent::KeyRelease:
4117 {
4118 const QKeyEvent *ke = static_cast<const QKeyEvent *>(e);
4119 dbg << "QKeyEvent(";
4121 dbg << ", ";
4122 QtDebugUtils::formatQEnum(dbg, static_cast<Qt::Key>(ke->key()));
4124 if (!ke->text().isEmpty())
4125 dbg << ", text=" << ke->text();
4126 if (ke->isAutoRepeat())
4127 dbg << ", autorepeat, count=" << ke->count();
4128 dbg << ')';
4129 }
4130 break;
4131#if QT_CONFIG(shortcut)
4132 case QEvent::Shortcut: {
4133 const QShortcutEvent *se = static_cast<const QShortcutEvent *>(e);
4134 dbg << "QShortcutEvent(" << se->key().toString() << ", id=" << se->shortcutId();
4135 if (se->isAmbiguous())
4136 dbg << ", ambiguous";
4137 dbg << ')';
4138 }
4139 break;
4140#endif
4142 case QEvent::FocusIn:
4143 case QEvent::FocusOut:
4144 dbg << "QFocusEvent(";
4146 dbg << ", ";
4147 QtDebugUtils::formatQEnum(dbg, static_cast<const QFocusEvent *>(e)->reason());
4148 dbg << ')';
4149 break;
4150 case QEvent::Move: {
4151 const QMoveEvent *me = static_cast<const QMoveEvent *>(e);
4152 dbg << "QMoveEvent(";
4153 QtDebugUtils::formatQPoint(dbg, me->pos());
4154 if (!me->spontaneous())
4155 dbg << ", non-spontaneous";
4156 dbg << ')';
4157 }
4158 break;
4159 case QEvent::Resize: {
4160 const QResizeEvent *re = static_cast<const QResizeEvent *>(e);
4161 dbg << "QResizeEvent(";
4162 QtDebugUtils::formatQSize(dbg, re->size());
4163 if (!re->spontaneous())
4164 dbg << ", non-spontaneous";
4165 dbg << ')';
4166 }
4167 break;
4168# if QT_CONFIG(draganddrop)
4169 case QEvent::DragEnter:
4170 case QEvent::DragMove:
4171 case QEvent::Drop:
4172 formatDropEvent(dbg, static_cast<const QDropEvent *>(e));
4173 break;
4174# endif // QT_CONFIG(draganddrop)
4176 formatInputMethodEvent(dbg, static_cast<const QInputMethodEvent *>(e));
4177 break;
4179 formatInputMethodQueryEvent(dbg, static_cast<const QInputMethodQueryEvent *>(e));
4180 break;
4181 case QEvent::TouchBegin:
4183 case QEvent::TouchEnd:
4184 formatTouchEvent(dbg, *static_cast<const QTouchEvent*>(e));
4185 break;
4186 case QEvent::ChildAdded:
4189 dbg << "QChildEvent(";
4191 dbg << ", " << (static_cast<const QChildEvent*>(e))->child() << ')';
4192 break;
4193# ifndef QT_NO_GESTURES
4194 case QEvent::NativeGesture: {
4195 const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e);
4196 dbg << "QNativeGestureEvent(";
4197 QtDebugUtils::formatQEnum(dbg, ne->gestureType());
4198 dbg << ", fingerCount=" << ne->fingerCount() << ", localPos=";
4199 QtDebugUtils::formatQPoint(dbg, ne->position());
4200 if (!qIsNull(ne->value()))
4201 dbg << ", value=" << ne->value();
4202 if (!ne->delta().isNull()) {
4203 dbg << ", delta=";
4204 QtDebugUtils::formatQPoint(dbg, ne->delta());
4205 }
4206 dbg << ')';
4207 }
4208 break;
4209# endif // !QT_NO_GESTURES
4211 dbg << "QApplicationStateChangeEvent(";
4212 QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState());
4213 dbg << ')';
4214 break;
4215# ifndef QT_NO_CONTEXTMENU
4217 dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')';
4218 break;
4219# endif // !QT_NO_CONTEXTMENU
4220# if QT_CONFIG(tabletevent)
4224 case QEvent::TabletMove:
4226 formatTabletEvent(dbg, static_cast<const QTabletEvent *>(e));
4227 break;
4228# endif // QT_CONFIG(tabletevent)
4229 case QEvent::Enter:
4230 dbg << "QEnterEvent(" << static_cast<const QEnterEvent *>(e)->position() << ')';
4231 break;
4232 case QEvent::Timer:
4233 dbg << "QTimerEvent(id=" << static_cast<const QTimerEvent *>(e)->timerId() << ')';
4234 break;
4236 dbg << "QPlatformSurfaceEvent(surfaceEventType=";
4237 switch (static_cast<const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {
4239 dbg << "SurfaceCreated";
4240 break;
4242 dbg << "SurfaceAboutToBeDestroyed";
4243 break;
4244 }
4245 dbg << ')';
4246 break;
4247 case QEvent::ScrollPrepare: {
4248 const QScrollPrepareEvent *se = static_cast<const QScrollPrepareEvent *>(e);
4249 dbg << "QScrollPrepareEvent(viewportSize=" << se->viewportSize()
4250 << ", contentPosRange=" << se->contentPosRange()
4251 << ", contentPos=" << se->contentPos() << ')';
4252 }
4253 break;
4254 case QEvent::Scroll: {
4255 const QScrollEvent *se = static_cast<const QScrollEvent *>(e);
4256 dbg << "QScrollEvent(contentPos=" << se->contentPos()
4257 << ", overshootDistance=" << se->overshootDistance()
4258 << ", scrollState=" << se->scrollState() << ')';
4259 }
4260 break;
4261 default:
4262 dbg << eventClassName(type) << '(';
4264 dbg << ", " << (const void *)e << ')';
4265 break;
4266 }
4267 return dbg;
4268}
4269#endif // !QT_NO_DEBUG_STREAM
4270
4327QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates oldState, bool isOverride)
4328 : QEvent(WindowStateChange), m_oldStates(oldState), m_override(isOverride)
4329{
4330}
4331
4335{
4336 return m_override;
4337}
4338
4340
4341
4342
4481 const QPointingDevice *device,
4482 Qt::KeyboardModifiers modifiers,
4483 const QList<QEventPoint> &touchPoints)
4484 : QPointerEvent(eventType, device, modifiers, touchPoints),
4485 m_target(nullptr)
4486{
4487 for (QEventPoint &point : m_points) {
4488 m_touchPointStates |= point.state();
4489 QMutableEventPoint::setDevice(point, device);
4490 }
4491}
4492
4493#if QT_DEPRECATED_SINCE(6, 0)
4502 const QPointingDevice *device,
4503 Qt::KeyboardModifiers modifiers,
4504 QEventPoint::States touchPointStates,
4505 const QList<QEventPoint> &touchPoints)
4506 : QPointerEvent(eventType, device, modifiers, touchPoints),
4507 m_target(nullptr),
4508 m_touchPointStates(touchPointStates)
4509{
4510 for (QEventPoint &point : m_points)
4511 QMutableEventPoint::setDevice(point, device);
4512}
4513#endif // QT_DEPRECATED_SINCE(6, 0)
4514
4516
4517
4520bool QTouchEvent::isBeginEvent() const
4521{
4522 return m_touchPointStates.testFlag(QEventPoint::State::Pressed);
4523}
4524
4530{
4533}
4534
4539{
4541}
4542
4585 : QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
4586{
4587}
4588
4590
4591
4619void QScrollPrepareEvent::setViewportSize(const QSizeF &size)
4620{
4621 m_viewportSize = size;
4622}
4623
4630{
4631 m_contentPosRange = rect;
4632}
4633
4640{
4641 m_contentPos = pos;
4642}
4643
4644
4682QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDistance, ScrollState scrollState)
4683 : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)
4684{
4685}
4686
4688
4689
4720 : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)
4721{
4722}
4723
4725
4726
4743 : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState)
4744{
4745}
4746
4748
4749
4756 = default;
4757
4762{
4764 auto &added = m_points.last();
4765 if (!added.device())
4766 QMutableEventPoint::setDevice(added, pointingDevice());
4768}
4769
4770
4772 = default;
4773
4775
4776#include "moc_qevent.cpp"
NSData * m_data
IOBluetoothDevice * device
The QActionEvent class provides an event that is generated when a QAction is added,...
The QAction class provides an abstraction for user commands that can be added to different user inter...
Definition qaction.h:30
\inmodule QtCore
Definition qcoreevent.h:372
The QCloseEvent class contains parameters that describe a close event.
Definition qevent.h:561
The QContextMenuEvent class contains parameters that describe a context menu event.
Definition qevent.h:593
QContextMenuEvent(Reason reason, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
Constructs a context menu event object with the accept parameter flag set to false.
Definition qevent.cpp:1929
QPoint m_globalPos
Definition qevent.h:617
Reason
This enum describes the reason why the event was sent.
Definition qevent.h:596
The QCursor class provides a mouse cursor with an arbitrary shape.
Definition qcursor.h:45
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
Definition qcursor.cpp:188
\inmodule QtCore
\inmodule QtCore
static QDragManager * self()
Definition qdnd.cpp:30
\inmodule QtGui
Definition qevent.h:164
QEnterEvent(const QPointF &localPos, const QPointF &scenePos, const QPointF &globalPos, const QPointingDevice *device=QPointingDevice::primaryPointingDevice())
Constructs an enter event object originating from device.
Definition qevent.cpp:73
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
QPointF pressPosition
the position at which this point was pressed.
Definition qeventpoint.h:37
QPointF globalPosition
the global position of this point.
Definition qeventpoint.h:44
qreal pressure
the pressure of this point.
Definition qeventpoint.h:32
int id
the ID number of this event point.
Definition qeventpoint.h:25
QPointF scenePosition
the scene position of this point.
Definition qeventpoint.h:40
State state
the current state of the event point.
Definition qeventpoint.h:27
ulong timestamp
the most recent time at which this point was included in a QPointerEvent.
Definition qeventpoint.h:28
qreal rotation
the angular orientation of this point.
Definition qeventpoint.h:33
QSizeF ellipseDiameters
the width and height of the bounding ellipse of the touch point.
Definition qeventpoint.h:34
QPointF position
the position of this point.
Definition qeventpoint.h:36
QPointF lastPosition
the position of this point from the previous press or move event.
Definition qeventpoint.h:39
QVector2D velocity
a velocity vector, in units of pixels per second, in the coordinate.
Definition qeventpoint.h:35
\inmodule QtCore
Definition qcoreevent.h:45
virtual void setAccepted(bool accepted)
Definition qcoreevent.h:302
bool spontaneous() const
Returns true if the event originated outside the application (a system event); otherwise returns fals...
Definition qcoreevent.h:300
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
@ OrientationChange
Definition qcoreevent.h:262
@ TabletMove
Definition qcoreevent.h:121
@ GraphicsSceneDragLeave
Definition qcoreevent.h:200
@ GraphicsSceneMouseMove
Definition qcoreevent.h:189
@ ActionRemoved
Definition qcoreevent.h:153
@ NonClientAreaMouseButtonDblClick
Definition qcoreevent.h:215
@ StatusTip
Definition qcoreevent.h:149
@ WindowStateChange
Definition qcoreevent.h:143
@ TabletEnterProximity
Definition qcoreevent.h:209
@ GestureOverride
Definition qcoreevent.h:254
@ GraphicsSceneContextMenu
Definition qcoreevent.h:193
@ FocusAboutToChange
Definition qcoreevent.h:68
@ GraphicsSceneMouseRelease
Definition qcoreevent.h:191
@ ActionAdded
Definition qcoreevent.h:152
@ ChildPolished
Definition qcoreevent.h:107
@ GraphicsSceneDragEnter
Definition qcoreevent.h:198
@ GraphicsSceneDragMove
Definition qcoreevent.h:199
@ ShortcutOverride
Definition qcoreevent.h:158
@ FocusOut
Definition qcoreevent.h:67
@ InputMethod
Definition qcoreevent.h:120
@ ChildRemoved
Definition qcoreevent.h:108
@ GraphicsSceneMousePress
Definition qcoreevent.h:190
@ NativeGesture
Definition qcoreevent.h:246
@ DragEnter
Definition qcoreevent.h:101
@ InputMethodQuery
Definition qcoreevent.h:261
@ ActionChanged
Definition qcoreevent.h:151
@ KeyRelease
Definition qcoreevent.h:65
@ MouseMove
Definition qcoreevent.h:63
@ KeyPress
Definition qcoreevent.h:64
@ ApplicationStateChange
Definition qcoreevent.h:273
@ FocusIn
Definition qcoreevent.h:66
@ MouseButtonPress
Definition qcoreevent.h:60
@ TouchUpdate
Definition qcoreevent.h:242
@ TouchBegin
Definition qcoreevent.h:241
@ HoverLeave
Definition qcoreevent.h:176
@ NonClientAreaMouseMove
Definition qcoreevent.h:212
@ HoverEnter
Definition qcoreevent.h:175
@ GraphicsSceneHoverLeave
Definition qcoreevent.h:196
@ NonClientAreaMouseButtonRelease
Definition qcoreevent.h:214
@ GraphicsSceneMouseDoubleClick
Definition qcoreevent.h:192
@ TabletRelease
Definition qcoreevent.h:127
@ GraphicsSceneWheel
Definition qcoreevent.h:202
@ GraphicsSceneDrop
Definition qcoreevent.h:201
@ PlatformSurface
Definition qcoreevent.h:278
@ HoverMove
Definition qcoreevent.h:177
@ TabletPress
Definition qcoreevent.h:126
@ GraphicsSceneHoverEnter
Definition qcoreevent.h:194
@ MouseButtonDblClick
Definition qcoreevent.h:62
@ GraphicsSceneHoverMove
Definition qcoreevent.h:195
@ GraphicsSceneHelp
Definition qcoreevent.h:197
@ TabletLeaveProximity
Definition qcoreevent.h:210
@ ScrollPrepare
Definition qcoreevent.h:256
@ NonClientAreaMouseButtonPress
Definition qcoreevent.h:213
@ ContextMenu
Definition qcoreevent.h:119
@ MouseButtonRelease
Definition qcoreevent.h:61
@ ChildAdded
Definition qcoreevent.h:106
Type type() const
Returns the event type.
Definition qcoreevent.h:299
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
Definition qcoreevent.h:306
The QExposeEvent class contains event parameters for expose events. \inmodule QtGui.
Definition qevent.h:514
The QFileOpenEvent class provides an event that will be sent when there is a request to open a file o...
Definition qevent.h:847
QString file() const
Returns the name of the file that the application should open.
Definition qevent.h:853
QFileOpenEvent(const QString &file)
Definition qevent.cpp:3609
\inmodule QtCore
Definition qfile.h:93
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:469
QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason)
Constructs a focus event object.
Definition qevent.cpp:1557
static QPlatformIntegration * platformIntegration()
The QHelpEvent class provides an event that is used to request helpful information about a particular...
Definition qevent.h:787
QHelpEvent(Type type, const QPoint &pos, const QPoint &globalPos)
Constructs a help event with the given type corresponding to the widget-relative position specified b...
Definition qevent.cpp:3299
The QHideEvent class provides an event which is sent after a widget is hidden.
Definition qevent.h:585
QHideEvent()
Constructs a QHideEvent.
Definition qevent.cpp:3532
\inmodule QtGui
Definition qevent.h:245
QHoverEvent(Type type, const QPointF &scenePos, const QPointF &globalPos, const QPointF &oldPos, Qt::KeyboardModifiers modifiers=Qt::NoModifier, const QPointingDevice *device=QPointingDevice::primaryPointingDevice())
Constructs a hover event object originating from device.
Definition qevent.cpp:1054
The QIconDragEvent class indicates that a main icon drag has begun.
Definition qevent.h:569
The QInputDevice class describes a device from which a QInputEvent originates.
\inmodule QtGui
Definition qevent.h:49
virtual void setTimestamp(quint64 timestamp)
Definition qevent.h:59
const QInputDevice * device() const
Definition qevent.h:54
quint64 timestamp() const
Returns the window system's timestamp for this event.
Definition qevent.h:58
QInputEvent(Type type, const QInputDevice *m_dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
Definition qevent.cpp:147
const QInputDevice * m_dev
Definition qevent.h:65
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately before the event occurred.
Definition qevent.h:56
The QInputMethodEvent class provides parameters for input method events.
Definition qevent.h:624
QInputMethodEvent()
Constructs an event of type QEvent::InputMethod.
Definition qevent.cpp:2230
The QInputMethodQueryEvent class provides an event sent by the input context to input objects.
Definition qevent.h:678
QInputMethodQueryEvent(Qt::InputMethodQueries queries)
Constructs a query event for properties given by queries.
Definition qevent.cpp:2352
QVariant value(Qt::InputMethodQuery query) const
Returns value of the property query.
Definition qevent.cpp:2378
The QKeyEvent class describes a key event.
Definition qevent.h:423
int count() const
Returns the number of keys involved in this event.
Definition qevent.h:444
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
Definition qevent.cpp:1465
QString text() const
Returns the Unicode text that this key generated.
Definition qevent.h:442
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
Definition qevent.h:443
QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, const QString &text=QString(), bool autorep=false, quint16 count=1)
Constructs a key event object.
Definition qevent.cpp:1346
int key() const
Returns the code of the key that was pressed or released.
Definition qevent.h:433
The QKeySequence class encapsulates a key sequence as used by shortcuts.
static QList< QKeySequence > keyBindings(StandardKey key)
Definition qlist.h:74
qsizetype size() const noexcept
Definition qlist.h:386
bool isEmpty() const noexcept
Definition qlist.h:390
T & last()
Definition qlist.h:631
const_reference at(qsizetype i) const noexcept
Definition qlist.h:429
void append(parameter_type t)
Definition qlist.h:441
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtGui
Definition qevent.h:195
QMouseEvent(Type type, const QPointF &localPos, const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPointingDevice *device=QPointingDevice::primaryPointingDevice())
Constructs a mouse event object originating from device.
Definition qevent.cpp:723
Qt::MouseEventFlags flags() const
Definition qevent.cpp:813
The QMoveEvent class contains event parameters for move events.
Definition qevent.h:501
const QPoint & pos() const
Returns the new position of the widget.
Definition qevent.h:506
static Q_GUI_EXPORT void detach(QEventPoint &p)
static Q_GUI_EXPORT void setTimestamp(QEventPoint &p, ulong t)
~QMutableSinglePointEvent() override
~QMutableTouchEvent() override
void addPoint(const QEventPoint &point)
Definition qevent.cpp:4761
The QNativeGestureEvent class contains parameters that describe a gesture event. \inmodule QtGui.
static QObjectPrivate * get(QObject *o)
Definition qobject_p.h:153
\inmodule QtCore
Definition qobject.h:90
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:485
QPaintEvent(const QRegion &paintRegion)
Constructs a paint event object with the region that needs to be updated.
Definition qevent.cpp:1621
The QPlatformSurfaceEvent class is used to notify about native platform surface events....
Definition qevent.h:530
SurfaceEventType
This enum describes the type of platform surface event.
Definition qevent.h:533
SurfaceEventType surfaceEventType() const
Returns the specific type of platform surface event.
Definition qevent.h:540
\inmodule QtCore\reentrant
Definition qpoint.h:214
\inmodule QtCore\reentrant
Definition qpoint.h:23
A base class for pointer events.
Definition qevent.h:73
bool allPointsAccepted() const
Returns true if isPointAccepted() is true for every point in points(); otherwise false.
Definition qevent.cpp:303
bool removePassiveGrabber(const QEventPoint &point, QObject *grabber)
Removes the passive grabber from the given point if it was previously added.
Definition qevent.cpp:416
const QPointingDevice * pointingDevice() const
Returns the source device from which this event originates.
Definition qevent.cpp:327
void setTimestamp(quint64 timestamp) override
Definition qevent.cpp:335
void clearPassiveGrabbers(const QEventPoint &point)
Removes all passive grabbers from the given point.
Definition qevent.cpp:430
QList< QEventPoint > m_points
Definition qevent.h:104
void setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber)
Informs the delivery logic that the given exclusiveGrabber is to receive all future update events and...
Definition qevent.cpp:366
QEventPoint * pointById(int id)
Returns the point whose \l {QEventPoint::id()}{id} matches the given id, or nullptr if no such point ...
Definition qevent.cpp:277
bool addPassiveGrabber(const QEventPoint &point, QObject *grabber)
Informs the delivery logic that the given grabber is to receive all future update events and the rele...
Definition qevent.cpp:401
QEventPoint & point(qsizetype i)
Returns a QEventPoint reference for the point at index i.
Definition qevent.cpp:237
QObject * exclusiveGrabber(const QEventPoint &point) const
Returns the object which has been set to receive all future update events and the release event conta...
Definition qevent.cpp:348
QList< QPointer< QObject > > passiveGrabbers(const QEventPoint &point) const
Returns the list of objects that have been requested to receive all future update events and the rele...
Definition qevent.cpp:381
QPointerEvent(Type type, const QPointingDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier, const QList< QEventPoint > &points={})
virtual void setAccepted(bool accepted) override
\reimp
Definition qevent.cpp:315
bool allPointsGrabbed() const
Returns true if every point in points() has either an exclusiveGrabber() or one or more passiveGrabbe...
Definition qevent.cpp:290
EventPointData * queryPointById(int id) const
static QPointingDevicePrivate * get(QPointingDevice *q)
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:547
const QSize & size() const
Returns the new size of the widget.
Definition qevent.h:552
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
The QScrollEvent class is sent when scrolling.
Definition qevent.h:975
ScrollState scrollState() const
Returns the current scroll state as a combination of ScrollStateFlag values.
Definition qevent.h:989
QPointF contentPos() const
Returns the new scroll position.
Definition qevent.h:987
QScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState)
Creates a new QScrollEvent contentPos is the new content position, overshootDistance is the new overs...
Definition qevent.cpp:4682
QPointF overshootDistance() const
Returns the new overshoot distance.
Definition qevent.h:988
ScrollState
This enum describes the states a scroll event can have.
Definition qevent.h:979
The QScrollPrepareEvent class is sent in preparation of scrolling.
Definition qevent.h:951
void setContentPos(const QPointF &pos)
Sets the current content position to pos.
Definition qevent.cpp:4639
void setContentPosRange(const QRectF &rect)
Sets the range of content coordinates to rect.
Definition qevent.cpp:4629
QScrollPrepareEvent(const QPointF &startPos)
Creates new QScrollPrepareEvent The startPos is the position of a touch or mouse event that started t...
Definition qevent.cpp:4584
QPointF contentPos() const
Returns the current position of the content as set by setContentPos.
Definition qevent.h:960
QRectF contentPosRange() const
Returns the range of coordinates for the content as set by setContentPosRange().
Definition qevent.h:959
QSizeF viewportSize() const
Returns size of the area that is to be scrolled as set by setViewportSize.
Definition qevent.h:958
const_iterator cbegin() const noexcept
Definition qset.h:138
The QShortcutEvent class provides an event which is generated when the user presses a key combination...
The QShortcut class is used to create keyboard shortcuts.
Definition qshortcut.h:19
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:577
A base class for pointer events containing a single point, such as mouse events.
Definition qevent.h:108
Qt::MouseButton m_button
Definition qevent.h:145
QPointF globalPosition() const
Returns the position of the point in this event on the screen or virtual desktop.
Definition qevent.h:122
QPointF position() const
Returns the position of the point in this event, relative to the widget or item that received the eve...
Definition qevent.h:118
quint16 m_invertedScrolling
Definition qevent.h:160
bool isEndEvent() const override
Returns true if this event represents a \l {button()}{button} being released.
Definition qevent.cpp:601
bool isUpdateEvent() const override
Returns true if this event does not include a change in \l {buttons()}{button state}.
Definition qevent.cpp:591
Qt::MouseButtons m_mouseState
Definition qevent.h:146
QSinglePointEvent(Type type, const QPointingDevice *dev, const QEventPoint &point, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
quint16 m_doubleClick
Definition qevent.h:157
QPointF scenePosition() const
Returns the position of the point in this event, relative to the window or scene.
Definition qevent.h:120
Qt::MouseButton button() const
Returns the button that caused the event.
Definition qevent.h:115
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
Definition qevent.h:116
quint16 m_phase
Definition qevent.h:159
\inmodule QtCore
Definition qsize.h:207
constexpr qreal width() const noexcept
Returns the width.
Definition qsize.h:321
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
Definition qsize.h:315
constexpr qreal height() const noexcept
Returns the height.
Definition qsize.h:324
\inmodule QtCore
Definition qsize.h:25
The QStatusTipEvent class provides an event that is used to show messages in a status bar.
Definition qevent.h:807
QStatusTipEvent(const QString &tip)
Constructs a status tip event with the text specified by tip.
Definition qevent.cpp:3404
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:1083
\inmodule QtCore
Definition qcoreevent.h:359
The QToolBarChangeEvent class provides an event that is sent whenever a the toolbar button is clicked...
Definition qevent.h:866
QToolBarChangeEvent(bool t)
Definition qevent.cpp:3683
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:916
bool isEndEvent() const override
Returns true if this event includes at least one newly-released touchpoint.
Definition qevent.cpp:4538
bool isUpdateEvent() const override
Returns true if this event does not include newly-pressed or newly-released touchpoints.
Definition qevent.cpp:4529
QTouchEvent(QEvent::Type eventType, const QPointingDevice *device=nullptr, Qt::KeyboardModifiers modifiers=Qt::NoModifier, const QList< QEventPoint > &touchPoints={})
Definition qevent.cpp:4480
QEventPoint::States m_touchPointStates
Definition qevent.h:946
\inmodule QtCore
Definition qurl.h:94
\inmodule QtCore
Definition qvariant.h:64
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:31
constexpr QPointF toPointF() const noexcept
Returns the QPointF form of this 2D vector.
Definition qvectornd.h:628
\inmodule QtGui
Definition qevent.h:898
QWindowStateChangeEvent(Qt::WindowStates oldState, bool isOverride=false)
Definition qevent.cpp:4327
bool isOverride() const
Definition qevent.cpp:4334
EGLImageKHR int int EGLuint64KHR * modifiers
QString text
QPushButton * button
[2]
double e
QSet< QString >::iterator it
rect
[4]
Combined button and popup list for selecting options.
static void formatQEnum(QDebug &debug, QEnum value)
Definition qdebug_p.h:59
static void formatQFlags(QDebug &debug, const QFlags< Enum > &value)
Definition qdebug_p.h:79
static void formatQSize(QDebug &debug, const Size &size)
Definition qdebug_p.h:39
static void formatQPoint(QDebug &debug, const Point &point)
Definition qdebug_p.h:33
static void formatNonNullQFlags(QDebug &debug, const char *prefix, const QFlags< Enum > &value)
Definition qdebug_p.h:88
InputMethodQuery
@ ImInputItemClipRectangle
@ ImHints
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
MouseButton
Definition qnamespace.h:55
@ NoButton
Definition qnamespace.h:56
QTextStream & showbase(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ShowBase) on stream and r...
MouseEventSource
@ MouseEventNotSynthesized
QTextStream & noshowbase(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() & ~QTextStream::ShowBase) on stream and ...
@ Key_AltGr
Definition qnamespace.h:734
@ Key_Shift
Definition qnamespace.h:678
@ Key_Control
Definition qnamespace.h:679
@ Key_Alt
Definition qnamespace.h:681
@ Key_Meta
Definition qnamespace.h:680
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
@ ShiftModifier
@ ControlModifier
@ MetaModifier
@ GroupSwitchModifier
@ KeypadModifier
@ NoModifier
@ AltModifier
DropAction
@ IgnoreAction
NativeGestureType
ScrollPhase
@ ScrollBegin
@ ScrollUpdate
@ ScrollMomentum
@ ScrollEnd
@ NoMouseEventFlag
@ MouseEventCreatedDoubleClick
FocusReason
#define Q_FALLTHROUGH()
#define Q_UNLIKELY(x)
#define Q_IMPL_EVENT_COMMON(Class)
Definition qcoreevent.h:31
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e)
Definition qevent.cpp:3807
static void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)
Definition qevent.cpp:3778
#define Q_IMPL_POINTER_EVENT(Class)
Definition qevent.cpp:31
static void formatUnicodeString(QDebug d, const QString &s)
Definition qevent.cpp:3760
static const char * eventClassName(QEvent::Type t)
Definition qevent.cpp:3833
static QDebug operator<<(QDebug dbg, const QInputMethodEvent::Attribute &attr)
Definition qevent.cpp:3771
static void formatTouchEvent(QDebug d, const QTouchEvent &t)
Definition qevent.cpp:3750
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:287
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition qfloat16.h:303
bool qIsNull(qfloat16 f) noexcept
Definition qfloat16.h:308
#define qWarning
Definition qlogging.h:162
static const QMetaObjectPrivate * priv(const uint *data)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint index
[2]
GLuint GLuint end
GLenum GLuint id
[7]
GLenum GLenum GLsizei count
GLenum src
GLenum type
GLbitfield flags
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei GLsizei GLchar * source
GLfixed GLfixed GLint GLint GLfixed points
GLenum query
GLdouble GLdouble t
Definition qopenglext.h:243
GLdouble s
[6]
Definition qopenglext.h:235
GLfloat GLfloat p
[1]
static const QRectF boundingRect(const QPointF *points, int pointCount)
static QString toLocalFile(const QString &url)
Definition qqmlfile.cpp:611
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
QScreen * screen
[1]
Definition main.cpp:29
unsigned int quint32
Definition qtypes.h:45
unsigned short quint16
Definition qtypes.h:43
unsigned long long quint64
Definition qtypes.h:56
ptrdiff_t qsizetype
Definition qtypes.h:70
unsigned int uint
Definition qtypes.h:29
double qreal
Definition qtypes.h:92
QFile file
[0]
settings setValue("DataPump/bgcolor", color)
QUrl url("example.com")
[constructor-url-reference]
QObject::connect nullptr
QNetworkAccessManager manager
bool contains(const AT &t) const noexcept
Definition qlist.h:44
Definition moc.h:24
virtual HRESULT STDMETHODCALLTYPE Close(void)=0
virtual HRESULT STDMETHODCALLTYPE Move(enum TextUnit unit, int count, __RPC__out int *pRetVal)=0