8#include "private/qguiapplication_p.h"
9#include "private/qinputdevice_p.h"
10#include "private/qpointingdevice_p.h"
11#include "qpa/qplatformintegration.h"
12#include "private/qevent_p.h"
13#include "private/qeventpoint_p.h"
24#if QT_CONFIG(draganddrop)
25#include <qpa/qplatformdrag.h>
26#include <private/qdnd_p.h>
29#if QT_CONFIG(shortcut)
30#include <private/qshortcut_p.h>
33#include <private/qdebug_p.h>
35#define Q_IMPL_POINTER_EVENT(Class)
36 Class::Class(const Class &) = default;
37 Class::~Class() = default;
38 Class* Class::clone() const
40 auto c = new Class(*this);
41 for (auto &point : c->m_points)
42 QMutableEventPoint::detach(point);
45 Q_ASSERT(reinterpret_cast<quintptr>(c) == reinterpret_cast<quintptr>(e));
53static_assert(
sizeof(QMutableTouchEvent) ==
sizeof(QTouchEvent));
55static_assert(
sizeof(QMouseEvent) ==
sizeof(QSinglePointEvent));
56static_assert(
sizeof(QVector2D) ==
sizeof(quint64));
59
60
61
62
63
64
65
66
67
68
71
72
73
74
75
76
77QEnterEvent::QEnterEvent(
const QPointF &localPos,
const QPointF &scenePos,
const QPointF &globalPos,
const QPointingDevice *device)
78 : QSinglePointEvent(QEvent::Enter, device, localPos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier)
85
86
87
88
89
91
92
93
94
95
97
98
99
100
101
103
104
105
106
107
109
110
111
112
113
115
116
117
118
119
121
122
123
124
125
127
128
129
130
131
133
134
135
136
137
140
141
142
143
144
145
146
149
150
151QInputEvent::QInputEvent(Type type,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
152 : QEvent(type, QEvent::InputEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
156
157
158QInputEvent::QInputEvent(QEvent::Type type, QEvent::PointerEventTag,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
159 : QEvent(type, QEvent::PointerEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
163
164
165QInputEvent::QInputEvent(QEvent::Type type, QEvent::SinglePointEventTag,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
166 : QEvent(type, QEvent::SinglePointEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
172
173
174
175
176
177
178
179
180
181
182
183
184
185
188
189
190
191
194
195
196
197
198
199
200
203
204
205
206
207
210
211
212
213
214
215
218
219
220
221
222
225
226
227
228
229
230
233
234
235
236
239
240
241QEventPoint &QPointerEvent::point(qsizetype i)
247
248
249
250
253
254
255
256
259
260
261QPointerEvent::QPointerEvent(QEvent::Type type,
const QPointingDevice *dev,
262 Qt::KeyboardModifiers modifiers,
const QList<QEventPoint> &points)
263 : QInputEvent(type, QEvent::PointerEventTag{}, dev, modifiers), m_points(points)
268
269
270QPointerEvent::QPointerEvent(QEvent::Type type, QEvent::SinglePointEventTag,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
271 : QInputEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers)
278
279
280
281QEventPoint *QPointerEvent::pointById(
int id)
283 for (
auto &p : m_points) {
291
292
293
294bool QPointerEvent::allPointsGrabbed()
const
296 for (
const auto &p : points()) {
297 if (!exclusiveGrabber(p) && passiveGrabbers(p).isEmpty())
304
305
306
307bool QPointerEvent::allPointsAccepted()
const
309 for (
const auto &p : points()) {
317
318
319void QPointerEvent::setAccepted(
bool accepted)
321 QEvent::setAccepted(accepted);
322 for (
auto &p : m_points)
323 p.setAccepted(accepted);
327
328
329
330
331const QPointingDevice *QPointerEvent::pointingDevice()
const
333 return static_cast<
const QPointingDevice *>(m_dev);
337
338
339void QPointerEvent::setTimestamp(quint64 timestamp)
341 QInputEvent::setTimestamp(timestamp);
342 for (
auto &p : m_points)
343 QMutableEventPoint::setTimestamp(p, timestamp);
347
348
349
350
351
352QObject *QPointerEvent::exclusiveGrabber(
const QEventPoint &point)
const
354 Q_ASSERT(pointingDevice());
355 auto persistentPoint = QPointingDevicePrivate::get(pointingDevice())->queryPointById(point.id());
356 if (Q_UNLIKELY(!persistentPoint)) {
357 qWarning() <<
"point is not in activePoints" << point;
360 return persistentPoint->exclusiveGrabber;
364
365
366
367
368
369
370void QPointerEvent::setExclusiveGrabber(
const QEventPoint &point, QObject *exclusiveGrabber)
372 Q_ASSERT(pointingDevice());
373 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
374 devPriv->setExclusiveGrabber(
this, point, exclusiveGrabber);
378
379
380
381
382
383
384
385QList<QPointer<QObject> > QPointerEvent::passiveGrabbers(
const QEventPoint &point)
const
387 Q_ASSERT(pointingDevice());
388 auto persistentPoint = QPointingDevicePrivate::get(pointingDevice())->queryPointById(point.id());
389 if (Q_UNLIKELY(!persistentPoint)) {
390 qWarning() <<
"point is not in activePoints" << point;
393 return persistentPoint->passiveGrabbers;
397
398
399
400
401
402
403
404
405bool QPointerEvent::addPassiveGrabber(
const QEventPoint &point, QObject *grabber)
407 Q_ASSERT(pointingDevice());
408 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
409 return devPriv->addPassiveGrabber(
this, point, grabber);
413
414
415
416
417
418
419
420bool QPointerEvent::removePassiveGrabber(
const QEventPoint &point, QObject *grabber)
422 Q_ASSERT(pointingDevice());
423 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
424 return devPriv->removePassiveGrabber(
this, point, grabber);
428
429
430
431
432
433
434void QPointerEvent::clearPassiveGrabbers(
const QEventPoint &point)
436 Q_ASSERT(pointingDevice());
437 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
438 devPriv->clearPassiveGrabbers(
this, point);
442
443
444
445
446
447
448
451
452
453
454
455
456
457
458
459
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
481
482
483
484
485
486
487
488
489
492
493
494
495
496
497
500
501
502
503
504
505
506
507
508
509
510
511
514
515
516QSinglePointEvent::QSinglePointEvent(QEvent::Type type,
const QPointingDevice *dev,
517 const QPointF &localPos,
const QPointF &scenePos,
const QPointF &globalPos,
518 Qt::MouseButton button, Qt::MouseButtons buttons,
519 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
520 : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
522 m_mouseState(buttons),
524 m_reserved(0), m_reserved2(0),
525 m_doubleClick(
false), m_phase(0), m_invertedScrolling(0)
527 const bool isPress = (button != Qt::NoButton && (button | buttons) == buttons);
528 const bool isWheel = (type == QEvent::Type::Wheel);
529 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
530 auto epd = devPriv->pointById(0);
531 QEventPoint &p = epd->eventPoint;
532 QMutableEventPoint::detach(p);
533 Q_ASSERT(p.device() == dev);
534 if (isPress || isWheel)
535 QMutableEventPoint::setGlobalLastPosition(p, globalPos);
537 QMutableEventPoint::setGlobalLastPosition(p, p.globalPosition());
538 QMutableEventPoint::setGlobalPosition(p, globalPos);
539 if (isWheel && p.state() != QEventPoint::State::Updated)
540 QMutableEventPoint::setGlobalPressPosition(p, globalPos);
541 if (type == MouseButtonDblClick)
542 QMutableEventPoint::setState(p, QEventPoint::State::Stationary);
543 else if (button == Qt::NoButton || isWheel)
544 QMutableEventPoint::setState(p, QEventPoint::State::Updated);
546 QMutableEventPoint::setState(p, QEventPoint::State::Pressed);
548 QMutableEventPoint::setState(p, QEventPoint::State::Released);
549 QMutableEventPoint::setScenePosition(p, scenePos);
550 QMutableEventPoint::setPosition(p, localPos);
555
556
557
558
559
560
561
562QSinglePointEvent::QSinglePointEvent(QEvent::Type type,
const QPointingDevice *dev,
const QEventPoint &point,
563 Qt::MouseButton button, Qt::MouseButtons buttons,
564 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
565 : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
567 m_mouseState(buttons),
569 m_reserved(0), m_reserved2(0),
570 m_doubleClick(
false), m_phase(0), m_invertedScrolling(0)
578
579
580bool QSinglePointEvent::isBeginEvent()
const
585 return m_button != Qt::NoButton && m_mouseState.testFlag(m_button)
586 && type() != QEvent::MouseButtonDblClick;
590
591
592bool QSinglePointEvent::isUpdateEvent()
const
596 return m_button == Qt::NoButton || type() == QEvent::MouseButtonDblClick;
600
601
602bool QSinglePointEvent::isEndEvent()
const
604 return m_button != Qt::NoButton && !m_mouseState.testFlag(m_button);
608
609
610
611
612
613
614
615
616
617
618
619
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
670#if QT_DEPRECATED_SINCE(6
, 4
)
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693QMouseEvent::QMouseEvent(Type type,
const QPointF &localPos, Qt::MouseButton button,
694 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
695 : QSinglePointEvent(type, device, localPos, localPos,
701 button, buttons, modifiers)
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724QMouseEvent::QMouseEvent(Type type,
const QPointF &localPos,
const QPointF &globalPos,
725 Qt::MouseButton button, Qt::MouseButtons buttons,
726 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
727 : QMouseEvent(type, localPos, localPos, globalPos, button, buttons, modifiers, device)
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748QMouseEvent::QMouseEvent(QEvent::Type type,
const QPointF &localPos,
749 const QPointF &scenePos,
const QPointF &globalPos,
750 Qt::MouseButton button, Qt::MouseButtons buttons,
751 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
752 : QSinglePointEvent(type, device, localPos, scenePos, globalPos, button, buttons, modifiers)
756QMouseEvent::QMouseEvent(QEvent::Type type,
const QPointF &localPos,
const QPointF &windowPos,
757 const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons,
758 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source,
759 const QPointingDevice *device)
760 : QSinglePointEvent(type, device, localPos, windowPos, globalPos, button, buttons, modifiers, source)
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
799Qt::MouseEventSource QMouseEvent::source()
const
801 return Qt::MouseEventSource(m_source);
805
806
807
808
809
810
811
812
813
814Qt::MouseEventFlags QMouseEvent::flags()
const
816 return (m_doubleClick ? Qt::MouseEventCreatedDoubleClick : Qt::NoMouseEventFlag);
820
821
822
823
824
825
826
827
828
829
830
831
832
833
836
837
838
839
840
841
842
843
844
845
848
849
850
851
852
853
854
855
856
857
858
859
860
861
864
865
866
867
868
869
870
871
872
873
876
877
878
879
880
881
882
883
884
885
886
887
890
891
892
893
894
895
896
897
898
899
900
901
904
905
906
907
908
909
910
911
914
915
916
917
918
919
920
921
924
925
926
927
928
929
930
931
934
935
936
937
938
939
940
941
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
993
994
995
996
997
998
999
1000
1001
1002
1003
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056QHoverEvent::QHoverEvent(Type type,
const QPointF &scenePos,
const QPointF &globalPos,
const QPointF &oldPos,
1057 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
1058 : QSinglePointEvent(type, device, scenePos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
1062#if QT_DEPRECATED_SINCE(6
, 3
)
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076QHoverEvent::QHoverEvent(Type type,
const QPointF &pos,
const QPointF &oldPos,
1077 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
1078 : QSinglePointEvent(type, device, pos, pos, pos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
1085#if QT_CONFIG(wheelevent)
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1120
1121
1122
1123
1124
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1147
1148
1149
1150
1151
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225QWheelEvent::QWheelEvent(
const QPointF &pos,
const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
1226 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
1227 bool inverted, Qt::MouseEventSource source,
const QPointingDevice *device)
1228 : QSinglePointEvent(Wheel, device, pos, pos, globalPos, Qt::NoButton, buttons, modifiers, source),
1229 m_pixelDelta(pixelDelta), m_angleDelta(angleDelta)
1232 m_invertedScrolling = inverted;
1235Q_IMPL_POINTER_EVENT(QWheelEvent)
1238
1239
1240bool QWheelEvent::isBeginEvent()
const
1242 return m_phase == Qt::ScrollBegin;
1246
1247
1248bool QWheelEvent::isUpdateEvent()
const
1250 return m_phase == Qt::ScrollUpdate || m_phase == Qt::ScrollMomentum;
1254
1255
1256bool QWheelEvent::isEndEvent()
const
1258 return m_phase == Qt::ScrollEnd;
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1361
1362
1363
1364
1365
1366
1367
1370
1371
1372
1373
1374
1375
1376
1377
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423QKeyEvent::QKeyEvent(Type type,
int key, Qt::KeyboardModifiers modifiers,
const QString& text,
1424 bool autorep, quint16 count)
1425 : QInputEvent(type, QInputDevice::primaryKeyboard(), modifiers), m_text(text), m_key(key),
1426 m_scanCode(0), m_virtualKey(0), m_nativeModifiers(0),
1427 m_count(count), m_autoRepeat(autorep)
1429 if (type == QEvent::ShortcutOverride)
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451QKeyEvent::QKeyEvent(Type type,
int key, Qt::KeyboardModifiers modifiers,
1452 quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
1453 const QString &text,
bool autorep, quint16 count,
const QInputDevice *device)
1454 : QInputEvent(type, device, modifiers), m_text(text), m_key(key),
1455 m_scanCode(nativeScanCode), m_virtualKey(nativeVirtualKey), m_nativeModifiers(nativeModifiers),
1456 m_count(count), m_autoRepeat(autorep)
1458 if (type == QEvent::ShortcutOverride)
1466
1467
1468
1469
1470
1471
1472
1473
1474
1477
1478
1479
1480
1481
1482
1483
1484
1487
1488
1489
1490
1491
1492
1493
1494
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1532
1533
1534
1535
1536
1537
1538
1539
1540
1542Qt::KeyboardModifiers QKeyEvent::modifiers()
const
1544 if (key() == Qt::Key_Shift)
1545 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
1546 if (key() == Qt::Key_Control)
1547 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
1548 if (key() == Qt::Key_Alt)
1549 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
1550 if (key() == Qt::Key_Meta)
1551 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
1552 if (key() == Qt::Key_AltGr)
1553 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
1554 return QInputEvent::modifiers();
1558
1559
1560
1561
1562
1563
1564
1566#if QT_CONFIG(shortcut)
1568
1569
1570
1571
1572
1573
1574bool QKeyEvent::matches(QKeySequence::StandardKey matchKey)
const
1577 uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
1579 const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey);
1580 return bindings.contains(QKeySequence(searchkey));
1586
1587
1588
1589
1590
1591
1592
1593
1594
1597
1598
1599
1600
1601
1602
1603
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1628
1629
1630
1631
1632
1633
1634QFocusEvent::QFocusEvent(Type type, Qt::FocusReason reason)
1635 : QEvent(type), m_reason(reason)
1641
1642
1643Qt::FocusReason QFocusEvent::reason()
const
1649
1650
1651
1652
1653
1656
1657
1658
1659
1660
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1695
1696
1697
1698QPaintEvent::QPaintEvent(
const QRegion& paintRegion)
1699 : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(
false)
1703
1704
1705
1706QPaintEvent::QPaintEvent(
const QRect &paintRect)
1707 : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(
false)
1714
1715
1716
1717
1718
1719
1722
1723
1724
1725
1726
1727
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1746
1747
1748
1749QMoveEvent::QMoveEvent(
const QPoint &pos,
const QPoint &oldPos)
1750 : QEvent(Move), m_pos(pos), m_oldPos(oldPos)
1756
1757
1758
1759
1760
1763
1764
1765
1766
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1791
1792
1793
1794QExposeEvent::QExposeEvent(
const QRegion &exposeRegion)
1796 , m_region(exposeRegion)
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1830
1831
1832
1833
1836
1837
1838QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType)
1839 : QEvent(PlatformSurface)
1840 , m_surfaceEventType(surfaceEventType)
1847
1848
1849
1850
1851
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1868
1869
1870
1871QResizeEvent::QResizeEvent(
const QSize &size,
const QSize &oldSize)
1872 : QEvent(Resize), m_size(size), m_oldSize(oldSize)
1878
1879
1880
1881
1882
1885
1886
1887
1888
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1938
1939
1940
1941
1942QCloseEvent::QCloseEvent()
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1966
1967
1968
1969
1970
1971QIconDragEvent::QIconDragEvent()
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2045#ifndef QT_NO_CONTEXTMENU
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos,
const QPoint &globalPos,
2058 Qt::KeyboardModifiers modifiers)
2059 : QInputEvent(ContextMenu, QPointingDevice::primaryPointingDevice(), modifiers), m_pos(pos), m_globalPos(globalPos), m_reason(reason)
2064#if QT_DEPRECATED_SINCE(6
, 4
)
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos)
2082 : QInputEvent(ContextMenu, QInputDevice::primaryKeyboard()), m_pos(pos), m_reason(reason)
2085 m_globalPos = QCursor::pos();
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2103
2104
2105
2106
2107
2108
2109
2112
2113
2114
2115
2116
2117
2118
2121
2122
2123
2124
2125
2126
2127
2130
2131
2132
2133
2134
2135
2136
2139
2140
2141
2142
2143
2144
2145
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2166
2167
2168
2169
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2336
2337
2338
2339
2342
2343
2344
2345
2346
2347
2350
2351
2352
2353
2354
2355
2356
2357
2360
2361
2362
2363
2364
2365
2366QInputMethodEvent::QInputMethodEvent()
2367 : QEvent(QEvent::InputMethod), m_replacementStart(0), m_replacementLength(0)
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381QInputMethodEvent::QInputMethodEvent(
const QString &preeditText,
const QList<Attribute> &attributes)
2382 : QEvent(QEvent::InputMethod), m_preedit(preeditText), m_attributes(attributes),
2383 m_replacementStart(0), m_replacementLength(0)
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405void QInputMethodEvent::setCommitString(
const QString &commitString,
int replaceFrom,
int replaceLength)
2407 m_commit = commitString;
2408 m_replacementStart = replaceFrom;
2409 m_replacementLength = replaceLength;
2413
2414
2415
2416
2417
2418
2419
2420
2421
2424
2425
2426
2427
2428
2429
2430
2433
2434
2435
2436
2437
2438
2439
2440
2441
2444
2445
2446
2447
2448
2449
2450
2453
2454
2455
2456
2457
2458
2459
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2480
2481
2482
2483
2486
2487
2488QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries)
2489 : QEvent(InputMethodQuery),
2497
2498
2499void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query,
const QVariant &value)
2501 for (
int i = 0; i < m_values.size(); ++i) {
2502 if (m_values.at(i).query == query) {
2503 m_values[i].value = value;
2507 QueryPair pair = { query, value };
2508 m_values.append(pair);
2512
2513
2514QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query)
const
2516 for (
int i = 0; i < m_values.size(); ++i)
2517 if (m_values.at(i).query == query)
2518 return m_values.at(i).value;
2522#if QT_CONFIG(tabletevent)
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630QTabletEvent::QTabletEvent(Type type,
const QPointingDevice *dev,
const QPointF &pos,
const QPointF &globalPos,
2631 qreal pressure,
float xTilt,
float yTilt,
2632 float tangentialPressure, qreal rotation,
float z,
2633 Qt::KeyboardModifiers keyState,
2634 Qt::MouseButton button, Qt::MouseButtons buttons)
2635 : QSinglePointEvent(type, dev, pos, pos, globalPos, button, buttons, keyState),
2636 m_tangential(tangentialPressure),
2641 QEventPoint &p = point(0);
2642 QMutableEventPoint::setPressure(p, pressure);
2643 QMutableEventPoint::setRotation(p, rotation);
2646Q_IMPL_POINTER_EVENT(QTabletEvent)
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2663
2664
2665
2666
2667
2668
2669
2670
2671
2674
2675
2676
2677
2678
2679
2680
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2725
2726
2727
2728
2729
2730
2731
2732
2735
2736
2737
2738
2739
2740
2741
2742
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2770
2771
2772
2773
2774
2775
2776
2777
2780
2781
2782
2783
2784
2785
2786
2787
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2840#ifndef QT_NO_GESTURES
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2906#if QT_DEPRECATED_SINCE(6
, 2
)
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
2925 const QPointF &localPos,
const QPointF &scenePos,
2926 const QPointF &globalPos, qreal realValue, quint64 sequenceId,
2928 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2929 Qt::NoButton, Qt::NoModifier),
2930 m_sequenceId(sequenceId), m_realValue(realValue), m_gestureType(type)
2932 if (qIsNull(realValue) && intValue != 0)
2933 m_realValue = intValue;
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
int fingerCount,
2961 const QPointF &localPos,
const QPointF &scenePos,
2962 const QPointF &globalPos, qreal value,
const QPointF &delta,
2964 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2965 Qt::NoButton, Qt::NoModifier),
2966 m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
2968 Q_ASSERT(fingerCount < 16);
2974
2975
2976
2977
2978
2981
2982
2983
2984
2985
2986
2987
2990
2991
2992
2993
2994
2995
2996
2997
2998
3001
3002
3003
3004
3005
3006
3007
3008
3009
3012
3013
3014
3015
3016
3017
3020
3021
3022
3023
3024
3025
3026
3029
3030
3031
3032
3033
3034
3035
3038
3039
3040
3041
3042
3043
3046
3047
3048
3049
3050
3051
3052
3055#if QT_CONFIG(draganddrop)
3057#if QT_DEPRECATED_SINCE(6
, 16
)
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071QDragMoveEvent::QDragMoveEvent(
const QPoint& pos, Qt::DropActions actions,
const QMimeData *data,
3072 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3073 : QDropEvent(QPointF(pos), actions, data, buttons, modifiers, type)
3074 , m_rect(pos, QSize(1, 1))
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090QDragMoveEvent::QDragMoveEvent(QPointF pos, Qt::DropActions actions,
const QMimeData *data,
3091 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3092 : QDropEvent(pos, actions, data, buttons, modifiers, type)
3093 , m_rect(pos.toPoint(), QSize(1, 1))
3096Q_IMPL_EVENT_COMMON(QDragMoveEvent)
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3112
3113
3114
3115
3116
3117
3120
3121
3122
3123
3124
3125
3128
3129
3130
3131
3132
3133
3136
3137
3138
3139
3140
3141
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3180
3181
3182
3183
3184
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198QDropEvent::QDropEvent(
const QPointF& pos, Qt::DropActions actions,
const QMimeData *data,
3199 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3200 : QEvent(type), m_pos(pos), m_mouseState(buttons),
3201 m_modState(modifiers), m_actions(actions),
3204 m_defaultAction = m_dropAction =
3205 QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(m_actions, modifiers);
3209Q_IMPL_EVENT_COMMON(QDropEvent)
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223QObject* QDropEvent::source()
const
3225 if (
const QDragManager *manager = QDragManager::self())
3226 return manager->source();
3231void QDropEvent::setDropAction(Qt::DropAction action)
3233 if (!(action & m_actions) && action != Qt::IgnoreAction)
3234 action = m_defaultAction;
3235 m_dropAction = action;
3239
3240
3241
3242
3243
3246
3247
3248
3249
3250
3253
3254
3255
3256
3257
3260
3261
3262
3263
3264
3267
3268
3269
3270
3271
3274
3275
3276
3277
3278
3281
3282
3283
3284
3285
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3304
3305
3306
3307
3308
3309
3310
3311
3314
3315
3316
3317
3318
3319
3322
3323
3324
3325
3326
3327
3330
3331
3332
3333
3334
3335
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3358#if QT_DEPRECATED_SINCE(6
, 16
)
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372QDragEnterEvent::QDragEnterEvent(
const QPoint& point, Qt::DropActions actions,
const QMimeData *data,
3373 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3374 : QDragMoveEvent(QPointF(point), actions, data, buttons, modifiers, DragEnter)
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390QDragEnterEvent::QDragEnterEvent(QPointF point, Qt::DropActions actions,
const QMimeData *data,
3391 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3392 : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
3395Q_IMPL_EVENT_COMMON(QDragEnterEvent)
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3440
3441
3442
3443
3444
3445QDragLeaveEvent::QDragLeaveEvent()
3449Q_IMPL_EVENT_COMMON(QDragLeaveEvent)
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3470
3471
3472
3473
3474
3475
3476
3477
3478QHelpEvent::QHelpEvent(Type type,
const QPoint &pos,
const QPoint &globalPos)
3479 : QEvent(type), m_pos(pos), m_globalPos(globalPos)
3483
3484
3485
3486
3487
3488
3491
3492
3493
3494
3495
3496
3499
3500
3501
3502
3503
3504
3507
3508
3509
3510
3511
3512
3515
3516
3517
3518
3519
3520
3521
3524
3525
3526
3527
3528
3529
3530
3534#ifndef QT_NO_STATUSTIP
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3579
3580
3581
3582
3583QStatusTipEvent::QStatusTipEvent(
const QString &tip)
3584 : QEvent(StatusTip), m_tip(tip)
3590
3591
3592
3593
3594
3595
3599#if QT_CONFIG(whatsthis)
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3614
3615
3616
3617
3618
3619QWhatsThisClickedEvent::QWhatsThisClickedEvent(
const QString &href)
3620 : QEvent(WhatsThisClicked), m_href(href)
3623Q_IMPL_EVENT_COMMON(QWhatsThisClickedEvent)
3626
3627
3628
3629
3630
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3654
3655
3656
3657
3658
3659
3660
3661QActionEvent::QActionEvent(
int type, QAction *action, QAction *before)
3662 : QEvent(
static_cast<QEvent::Type>(type)), m_action(action), m_before(before)
3665Q_IMPL_EVENT_COMMON(QActionEvent)
3668
3669
3670
3671
3672
3673
3676
3677
3678
3679
3680
3681
3682
3683
3684
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3709
3710
3711QHideEvent::QHideEvent()
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3735
3736
3737QShowEvent::QShowEvent()
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3788
3789
3790
3791
3792QFileOpenEvent::QFileOpenEvent(
const QString &file)
3793 : QEvent(FileOpen), m_file(file), m_url(QUrl::fromLocalFile(file))
3798
3799
3800
3801
3802QFileOpenEvent::QFileOpenEvent(
const QUrl &url)
3803 : QEvent(FileOpen), m_file(url.toLocalFile()), m_url(url)
3810
3811
3812
3813
3814
3815
3818
3819
3820
3821
3822
3823
3825#if QT_DEPRECATED_SINCE(6
, 6
)
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags)
const
3840 file.setFileName(m_file);
3841 return file.open(flags);
3845#ifndef QT_NO_TOOLBAR
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3862
3863
3864
3865
3866QToolBarChangeEvent::QToolBarChangeEvent(
bool t)
3867 : QEvent(ToolBarChange), m_toggle(t)
3873
3874
3875
3878
3879
3880
3881
3882
3883
3884
3885
3889#if QT_CONFIG(shortcut)
3892
3893
3894
3895
3896
3897
3898
3899
3900QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
int id,
bool ambiguous)
3901 : QEvent(Shortcut), m_sequence(key), m_shortcutId(id), m_ambiguous(ambiguous)
3906
3907
3908
3909
3910
3911
3912
3913QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
const QShortcut *shortcut,
bool ambiguous)
3914 : QEvent(Shortcut), m_sequence(key), m_shortcutId(0), m_ambiguous(ambiguous)
3917 auto priv =
static_cast<
const QShortcutPrivate *>(QShortcutPrivate::get(shortcut));
3918 auto index = priv->sc_sequences.indexOf(key);
3920 qWarning() <<
"Given QShortcut does not contain key-sequence " << key;
3923 m_shortcutId = priv->sc_ids[index];
3927Q_IMPL_EVENT_COMMON(QShortcutEvent)
3931#ifndef QT_NO_DEBUG_STREAM
3935 d <<
"QTouchEvent(";
3936 QtDebugUtils::formatQEnum(d, t.type());
3937 d <<
" device: " << t.device()->name();
3939 QtDebugUtils::formatQFlags(d, t.touchPointStates());
3940 d <<
", " << t.points().size() <<
" points: " << t.points() <<
')';
3945 d <<
'"' << Qt::hex;
3946 for (
int i = 0; i < s.size(); ++i) {
3949 d <<
"U+" << s.at(i).unicode();
3951 d << Qt::dec <<
'"';
3956 dbg <<
"[type= " << attr.type <<
", start=" << attr.start <<
", length=" << attr.length
3957 <<
", value=" << attr.value <<
']';
3963 d <<
"QInputMethodEvent(";
3964 if (!e->preeditString().isEmpty()) {
3966 formatUnicodeString(d, e->preeditString());
3968 if (!e->commitString().isEmpty()) {
3970 formatUnicodeString(d, e->commitString());
3972 if (e->replacementLength()) {
3973 d <<
", replacementStart=" << e->replacementStart() <<
", replacementLength="
3974 << e->replacementLength();
3976 const auto attributes = e->attributes();
3977 auto it = attributes.cbegin();
3978 const auto end = attributes.cend();
3980 d <<
", attributes= {";
3983 for (; it != end; ++it)
3992 QDebugStateSaver saver(d);
3994 const Qt::InputMethodQueries queries = e->queries();
3995 d <<
"QInputMethodQueryEvent(queries=" << Qt::showbase << Qt::hex <<
int(queries)
3996 << Qt::noshowbase << Qt::dec <<
", {";
3997 for (
unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
3998 if (queries & mask) {
3999 const Qt::InputMethodQuery query =
static_cast<Qt::InputMethodQuery>(mask);
4000 const QVariant value = e->value(query);
4001 if (value.isValid()) {
4003 QtDebugUtils::formatQEnum(d, query);
4005 if (query == Qt::ImHints)
4006 QtDebugUtils::formatQFlags(d, Qt::InputMethodHints(value.toInt()));
4008 d << value.toString();
4019 case QEvent::ActionAdded:
4020 case QEvent::ActionRemoved:
4021 case QEvent::ActionChanged:
4022 return "QActionEvent";
4023 case QEvent::MouseButtonPress:
4024 case QEvent::MouseButtonRelease:
4025 case QEvent::MouseButtonDblClick:
4026 case QEvent::MouseMove:
4027 case QEvent::NonClientAreaMouseMove:
4028 case QEvent::NonClientAreaMouseButtonPress:
4029 case QEvent::NonClientAreaMouseButtonRelease:
4030 case QEvent::NonClientAreaMouseButtonDblClick:
4031 return "QMouseEvent";
4032 case QEvent::DragEnter:
4033 return "QDragEnterEvent";
4034 case QEvent::DragMove:
4035 return "QDragMoveEvent";
4037 return "QDropEvent";
4038 case QEvent::KeyPress:
4039 case QEvent::KeyRelease:
4040 case QEvent::ShortcutOverride:
4042 case QEvent::FocusIn:
4043 case QEvent::FocusOut:
4044 case QEvent::FocusAboutToChange:
4045 return "QFocusEvent";
4046 case QEvent::ChildAdded:
4047 case QEvent::ChildPolished:
4048 case QEvent::ChildRemoved:
4049 return "QChildEvent";
4051 return "QPaintEvent";
4053 return "QMoveEvent";
4054 case QEvent::Resize:
4055 return "QResizeEvent";
4057 return "QShowEvent";
4059 return "QHideEvent";
4061 return "QEnterEvent";
4063 return "QCloseEvent";
4064 case QEvent::FileOpen:
4065 return "QFileOpenEvent";
4066#ifndef QT_NO_GESTURES
4067 case QEvent::NativeGesture:
4068 return "QNativeGestureEvent";
4069 case QEvent::Gesture:
4070 case QEvent::GestureOverride:
4071 return "QGestureEvent";
4073 case QEvent::HoverEnter:
4074 case QEvent::HoverLeave:
4075 case QEvent::HoverMove:
4076 return "QHoverEvent";
4077 case QEvent::TabletEnterProximity:
4078 case QEvent::TabletLeaveProximity:
4079 case QEvent::TabletPress:
4080 case QEvent::TabletMove:
4081 case QEvent::TabletRelease:
4082 return "QTabletEvent";
4083 case QEvent::StatusTip:
4084 return "QStatusTipEvent";
4085 case QEvent::ToolTip:
4086 return "QHelpEvent";
4087 case QEvent::WindowStateChange:
4088 return "QWindowStateChangeEvent";
4090 return "QWheelEvent";
4091 case QEvent::TouchBegin:
4092 case QEvent::TouchUpdate:
4093 case QEvent::TouchEnd:
4094 return "QTouchEvent";
4095 case QEvent::Shortcut:
4096 return "QShortcutEvent";
4097 case QEvent::InputMethod:
4098 return "QInputMethodEvent";
4099 case QEvent::InputMethodQuery:
4100 return "QInputMethodQueryEvent";
4101 case QEvent::OrientationChange:
4102 return "QScreenOrientationChangeEvent";
4103 case QEvent::ScrollPrepare:
4104 return "QScrollPrepareEvent";
4105 case QEvent::Scroll:
4106 return "QScrollEvent";
4107 case QEvent::GraphicsSceneMouseMove:
4108 case QEvent::GraphicsSceneMousePress:
4109 case QEvent::GraphicsSceneMouseRelease:
4110 case QEvent::GraphicsSceneMouseDoubleClick:
4111 return "QGraphicsSceneMouseEvent";
4112 case QEvent::GraphicsSceneContextMenu:
4113 case QEvent::GraphicsSceneHoverEnter:
4114 case QEvent::GraphicsSceneHoverMove:
4115 case QEvent::GraphicsSceneHoverLeave:
4116 case QEvent::GraphicsSceneHelp:
4117 case QEvent::GraphicsSceneDragEnter:
4118 case QEvent::GraphicsSceneDragMove:
4119 case QEvent::GraphicsSceneDragLeave:
4120 case QEvent::GraphicsSceneDrop:
4121 case QEvent::GraphicsSceneWheel:
4122 return "QGraphicsSceneEvent";
4124 return "QTimerEvent";
4125 case QEvent::PlatformSurface:
4126 return "QPlatformSurfaceEvent";
4133# if QT_CONFIG(draganddrop)
4135static void formatDropEvent(QDebug d,
const QDropEvent *e)
4137 const QEvent::Type type = e->type();
4138 d << eventClassName(type) <<
"(dropAction=";
4139 QtDebugUtils::formatQEnum(d, e->dropAction());
4140 d <<
", proposedAction=";
4141 QtDebugUtils::formatQEnum(d, e->proposedAction());
4142 d <<
", possibleActions=";
4143 QtDebugUtils::formatQFlags(d, e->possibleActions());
4145 QtDebugUtils::formatQPoint(d, e->position());
4146 if (type == QEvent::DragMove || type == QEvent::DragEnter)
4147 d <<
", answerRect=" <<
static_cast<
const QDragMoveEvent *>(e)->answerRect();
4148 d <<
", formats=" << e->mimeData()->formats();
4149 QtDebugUtils::formatNonNullQFlags(d,
", keyboardModifiers=", e->modifiers());
4151 QtDebugUtils::formatQFlags(d, e->buttons());
4156# if QT_CONFIG(tabletevent)
4158static void formatTabletEvent(QDebug d,
const QTabletEvent *e)
4160 const QEvent::Type type = e->type();
4162 d << eventClassName(type) <<
'(';
4163 QtDebugUtils::formatQEnum(d, type);
4165 QtDebugUtils::formatQFlags(d, e->buttons());
4167 QtDebugUtils::formatQPoint(d, e->position());
4168 d <<
" z=" << e->z()
4169 <<
" xTilt=" << e->xTilt()
4170 <<
" yTilt=" << e->yTilt();
4171 if (type == QEvent::TabletPress || type == QEvent::TabletMove)
4172 d <<
" pressure=" << e->pressure();
4173 if (e->device()->hasCapability(QInputDevice::Capability::Rotation))
4174 d <<
" rotation=" << e->rotation();
4175 if (e->deviceType() == QInputDevice::DeviceType::Airbrush)
4176 d <<
" tangentialPressure=" << e->tangentialPressure();
4177 d <<
" dev=" << e->device() <<
')';
4185 return dbg <<
"QEventPoint(0x0)";
4187 return operator<<(dbg, *tp);
4192 QDebugStateSaver saver(dbg);
4194 dbg <<
"QEventPoint(id=" << tp.id() <<
" ts=" << tp.timestamp();
4196 QtDebugUtils::formatQPoint(dbg, tp.position());
4198 QtDebugUtils::formatQPoint(dbg, tp.scenePosition());
4200 QtDebugUtils::formatQPoint(dbg, tp.globalPosition());
4202 QtDebugUtils::formatQEnum(dbg, tp.state());
4203 if (!qFuzzyIsNull(tp.pressure()) && !qFuzzyCompare(tp.pressure(), 1))
4204 dbg <<
" pressure=" << tp.pressure();
4205 if (!tp.ellipseDiameters().isEmpty() || !qFuzzyIsNull(tp.rotation())) {
4207 << tp.ellipseDiameters().width() <<
"x" << tp.ellipseDiameters().height()
4208 <<
" \u2221 " << tp.rotation() <<
')';
4211 QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF());
4213 QtDebugUtils::formatQPoint(dbg, tp.pressPosition());
4215 QtDebugUtils::formatQPoint(dbg, tp.lastPosition());
4217 QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPosition());
4224 QDebugStateSaver saver(dbg);
4227 return dbg <<
"QEvent(0x0)";
4230 const QEvent::Type type = e->type();
4231 bool isMouse =
false;
4233 case QEvent::Expose:
4234 dbg <<
"QExposeEvent()";
4237 dbg <<
"QPaintEvent(" <<
static_cast<
const QPaintEvent *>(e)->region() <<
')';
4239 case QEvent::MouseButtonPress:
4240 case QEvent::MouseMove:
4241 case QEvent::MouseButtonRelease:
4242 case QEvent::MouseButtonDblClick:
4243 case QEvent::NonClientAreaMouseButtonPress:
4244 case QEvent::NonClientAreaMouseMove:
4245 case QEvent::NonClientAreaMouseButtonRelease:
4246 case QEvent::NonClientAreaMouseButtonDblClick:
4249 case QEvent::HoverEnter:
4250 case QEvent::HoverMove:
4251 case QEvent::HoverLeave:
4253 const QSinglePointEvent *spe =
static_cast<
const QSinglePointEvent*>(e);
4254 const Qt::MouseButton button = spe->button();
4255 const Qt::MouseButtons buttons = spe->buttons();
4256 dbg << eventClassName(type) <<
'(';
4257 QtDebugUtils::formatQEnum(dbg, type);
4258 if (dbg.verbosity() > QDebug::DefaultVerbosity)
4259 dbg <<
" ts=" << spe->timestamp();
4261 if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
4263 QtDebugUtils::formatQEnum(dbg, button);
4265 if (buttons && button != buttons) {
4267 QtDebugUtils::formatQFlags(dbg, buttons);
4270 QtDebugUtils::formatNonNullQFlags(dbg,
", ", spe->modifiers());
4272 QtDebugUtils::formatQPoint(dbg, spe->position());
4274 QtDebugUtils::formatQPoint(dbg, spe->scenePosition());
4276 QtDebugUtils::formatQPoint(dbg, spe->globalPosition());
4277 dbg <<
" dev=" << spe->device() <<
')';
4279 auto src =
static_cast<
const QMouseEvent*>(e)->source();
4280 if (src != Qt::MouseEventNotSynthesized) {
4282 QtDebugUtils::formatQEnum(dbg, src);
4287# if QT_CONFIG(wheelevent)
4288 case QEvent::Wheel: {
4289 const QWheelEvent *we =
static_cast<
const QWheelEvent *>(e);
4290 dbg <<
"QWheelEvent(" << we->phase();
4291 if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
4292 dbg <<
", pixelDelta=" << we->pixelDelta() <<
", angleDelta=" << we->angleDelta();
4293 dbg <<
" dev=" << we->device() <<
')';
4298 case QEvent::KeyPress:
4299 case QEvent::KeyRelease:
4300 case QEvent::ShortcutOverride:
4302 const QKeyEvent *ke =
static_cast<
const QKeyEvent *>(e);
4303 dbg <<
"QKeyEvent(";
4304 QtDebugUtils::formatQEnum(dbg, type);
4306 QtDebugUtils::formatQEnum(dbg,
static_cast<Qt::Key>(ke->key()));
4307 QtDebugUtils::formatNonNullQFlags(dbg,
", ", ke->modifiers());
4308 if (!ke->text().isEmpty())
4309 dbg <<
", text=" << ke->text();
4310 if (ke->isAutoRepeat())
4311 dbg <<
", autorepeat, count=" << ke->count();
4312 if (dbg.verbosity() > QDebug::DefaultVerbosity) {
4313 dbg <<
", nativeScanCode=" << ke->nativeScanCode();
4314 dbg <<
", nativeVirtualKey=" << ke->nativeVirtualKey();
4319#if QT_CONFIG(shortcut)
4320 case QEvent::Shortcut: {
4321 const QShortcutEvent *se =
static_cast<
const QShortcutEvent *>(e);
4322 dbg <<
"QShortcutEvent(" << se->key().toString() <<
", id=" << se->shortcutId();
4323 if (se->isAmbiguous())
4324 dbg <<
", ambiguous";
4329 case QEvent::FocusAboutToChange:
4330 case QEvent::FocusIn:
4331 case QEvent::FocusOut:
4332 dbg <<
"QFocusEvent(";
4333 QtDebugUtils::formatQEnum(dbg, type);
4335 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QFocusEvent *>(e)->reason());
4338 case QEvent::Move: {
4339 const QMoveEvent *me =
static_cast<
const QMoveEvent *>(e);
4340 dbg <<
"QMoveEvent(";
4341 QtDebugUtils::formatQPoint(dbg, me->pos());
4342 if (!me->spontaneous())
4343 dbg <<
", non-spontaneous";
4347 case QEvent::Resize: {
4348 const QResizeEvent *re =
static_cast<
const QResizeEvent *>(e);
4349 dbg <<
"QResizeEvent(";
4350 QtDebugUtils::formatQSize(dbg, re->size());
4351 if (!re->spontaneous())
4352 dbg <<
", non-spontaneous";
4356# if QT_CONFIG(draganddrop)
4357 case QEvent::DragEnter:
4358 case QEvent::DragMove:
4360 formatDropEvent(dbg,
static_cast<
const QDropEvent *>(e));
4363 case QEvent::InputMethod:
4364 formatInputMethodEvent(dbg,
static_cast<
const QInputMethodEvent *>(e));
4366 case QEvent::InputMethodQuery:
4367 formatInputMethodQueryEvent(dbg,
static_cast<
const QInputMethodQueryEvent *>(e));
4369 case QEvent::TouchBegin:
4370 case QEvent::TouchUpdate:
4371 case QEvent::TouchEnd:
4372 formatTouchEvent(dbg, *
static_cast<
const QTouchEvent*>(e));
4374 case QEvent::ChildAdded:
4375 case QEvent::ChildPolished:
4376 case QEvent::ChildRemoved:
4377 dbg <<
"QChildEvent(";
4378 QtDebugUtils::formatQEnum(dbg, type);
4379 dbg <<
", " << (
static_cast<
const QChildEvent*>(e))->child() <<
')';
4381# ifndef QT_NO_GESTURES
4382 case QEvent::NativeGesture: {
4383 const QNativeGestureEvent *ne =
static_cast<
const QNativeGestureEvent *>(e);
4384 dbg <<
"QNativeGestureEvent(";
4385 QtDebugUtils::formatQEnum(dbg, ne->gestureType());
4386 if (dbg.verbosity() > QDebug::DefaultVerbosity)
4387 dbg <<
", ts=" << ne->timestamp();
4388 dbg <<
", fingerCount=" << ne->fingerCount() <<
", localPos=";
4389 QtDebugUtils::formatQPoint(dbg, ne->position());
4390 if (!qIsNull(ne->value()))
4391 dbg <<
", value=" << ne->value();
4392 if (!ne->delta().isNull()) {
4394 QtDebugUtils::formatQPoint(dbg, ne->delta());
4400 case QEvent::ApplicationStateChange:
4401 dbg <<
"QApplicationStateChangeEvent(";
4402 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QApplicationStateChangeEvent *>(e)->applicationState());
4405# ifndef QT_NO_CONTEXTMENU
4406 case QEvent::ContextMenu:
4407 dbg <<
"QContextMenuEvent(" <<
static_cast<
const QContextMenuEvent *>(e)->pos() <<
')';
4410# if QT_CONFIG(tabletevent)
4411 case QEvent::TabletEnterProximity:
4412 case QEvent::TabletLeaveProximity:
4413 case QEvent::TabletPress:
4414 case QEvent::TabletMove:
4415 case QEvent::TabletRelease:
4416 formatTabletEvent(dbg,
static_cast<
const QTabletEvent *>(e));
4420 dbg <<
"QEnterEvent(" <<
static_cast<
const QEnterEvent *>(e)->position() <<
')';
4423 dbg <<
"QTimerEvent(id=" <<
static_cast<
const QTimerEvent *>(e)->timerId() <<
')';
4425 case QEvent::PlatformSurface:
4426 dbg <<
"QPlatformSurfaceEvent(surfaceEventType=";
4427 switch (
static_cast<
const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {
4428 case QPlatformSurfaceEvent::SurfaceCreated:
4429 dbg <<
"SurfaceCreated";
4431 case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
4432 dbg <<
"SurfaceAboutToBeDestroyed";
4437 case QEvent::ScrollPrepare: {
4438 const QScrollPrepareEvent *se =
static_cast<
const QScrollPrepareEvent *>(e);
4439 dbg <<
"QScrollPrepareEvent(viewportSize=" << se->viewportSize()
4440 <<
", contentPosRange=" << se->contentPosRange()
4441 <<
", contentPos=" << se->contentPos() <<
')';
4444 case QEvent::Scroll: {
4445 const QScrollEvent *se =
static_cast<
const QScrollEvent *>(e);
4446 dbg <<
"QScrollEvent(contentPos=" << se->contentPos()
4447 <<
", overshootDistance=" << se->overshootDistance()
4448 <<
", scrollState=" << se->scrollState() <<
')';
4452 dbg << eventClassName(type) <<
'(';
4453 QtDebugUtils::formatQEnum(dbg, type);
4454 dbg <<
", " << (
const void *)e <<
')';
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4476
4477
4478
4479
4482
4483
4484
4485
4486
4487
4488
4489
4490
4493
4494
4495
4496
4497
4498
4499
4502
4503
4504
4505
4506
4507
4508
4511
4512
4513
4516
4517QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates oldState,
bool isOverride)
4518 : QEvent(WindowStateChange), m_oldStates(oldState), m_override(isOverride)
4523
4524bool QWindowStateChangeEvent::isOverride()
const
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4664
4665
4666
4668QTouchEvent::QTouchEvent(QEvent::Type eventType,
4669 const QPointingDevice *device,
4670 Qt::KeyboardModifiers modifiers,
4671 const QList<QEventPoint> &touchPoints)
4672 : QPointerEvent(eventType, device, modifiers, touchPoints),
4675 for (QEventPoint &point : m_points) {
4676 m_touchPointStates |= point.state();
4677 QMutableEventPoint::setDevice(point, device);
4681#if QT_DEPRECATED_SINCE(6
, 0
)
4683
4684
4685
4686
4687
4688
4689QTouchEvent::QTouchEvent(QEvent::Type eventType,
4690 const QPointingDevice *device,
4691 Qt::KeyboardModifiers modifiers,
4692 QEventPoint::States touchPointStates,
4693 const QList<QEventPoint> &touchPoints)
4694 : QPointerEvent(eventType, device, modifiers, touchPoints),
4696 m_touchPointStates(touchPointStates)
4698 for (QEventPoint &point : m_points)
4699 QMutableEventPoint::setDevice(point, device);
4706
4707
4708bool QTouchEvent::isBeginEvent()
const
4710 return m_touchPointStates.testFlag(QEventPoint::State::Pressed);
4714
4715
4716
4717bool QTouchEvent::isUpdateEvent()
const
4719 return !m_touchPointStates.testFlag(QEventPoint::State::Pressed) &&
4720 !m_touchPointStates.testFlag(QEventPoint::State::Released);
4724
4725
4726bool QTouchEvent::isEndEvent()
const
4728 return m_touchPointStates.testFlag(QEventPoint::State::Released);
4732
4733
4734
4735
4738
4739
4740
4743
4744
4745
4746
4747
4748
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4769
4770
4771
4772QScrollPrepareEvent::QScrollPrepareEvent(
const QPointF &startPos)
4773 : QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
4780
4781
4782
4783
4786
4787
4788
4789
4790
4793
4794
4795
4798
4799
4800
4803
4804
4805
4806
4807void QScrollPrepareEvent::setViewportSize(
const QSizeF &size)
4809 m_viewportSize = size;
4813
4814
4815
4816
4817void QScrollPrepareEvent::setContentPosRange(
const QRectF &rect)
4819 m_contentPosRange = rect;
4823
4824
4825
4826
4827void QScrollPrepareEvent::setContentPos(
const QPointF &pos)
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4865
4866
4867
4868
4869
4870QScrollEvent::QScrollEvent(
const QPointF &contentPos,
const QPointF &overshootDistance, ScrollState scrollState)
4871 : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)
4878
4879
4880
4881
4884
4885
4886
4887
4888
4889
4890
4893
4894
4895
4896
4897
4898
4899
4900
4901
4904
4905
4906
4907QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation)
4908 : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)
4915
4916
4917
4918
4921
4922
4923
4924
4927
4928
4929
4930QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState applicationState)
4931 : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState)
4938
4939
4940
4941
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4963
4964
4965
4966
4967
4968
4969
4970QChildWindowEvent::QChildWindowEvent(Type type, QWindow *childWindow)
4971 : QEvent(type), c(childWindow)
4978
4979
4980
4981
4983QMutableTouchEvent::~QMutableTouchEvent()
4987
4988
4989void QMutableTouchEvent::addPoint(QTouchEvent *e,
const QEventPoint &point)
4991 e->m_points.append(point);
4992 auto &added = e->m_points.last();
4993 if (!added.device())
4994 QMutableEventPoint::setDevice(added, e->pointingDevice());
4995 e->m_touchPointStates |= point.state();
4999QMutableSinglePointEvent::~QMutableSinglePointEvent()
5003
5004
5005void QMutableTouchEvent::addPoint(
const QEventPoint &point)
5007 addPoint(
this, point);
5012#include "moc_qevent.cpp"
The QCloseEvent class contains parameters that describe a close event.
The QExposeEvent class contains event parameters for expose events. \inmodule QtGui.
The QFileOpenEvent class provides an event that will be sent when there is a request to open a file o...
The QFocusEvent class contains event parameters for widget focus events.
The QHelpEvent class provides an event that is used to request helpful information about a particular...
The QHideEvent class provides an event which is sent after a widget is hidden.
The QIconDragEvent class indicates that a main icon drag has begun.
The QKeyEvent class describes a key event.
The QMoveEvent class contains event parameters for move events.
The QPaintEvent class contains event parameters for paint events.
The QResizeEvent class contains event parameters for resize events.
The QShowEvent class provides an event that is sent when a widget is shown.
A base class for pointer events containing a single point, such as mouse events.
The QStatusTipEvent class provides an event that is used to show messages in a status bar.
Combined button and popup list for selecting options.
QDebug operator<<(QDebug dbg, const NSObject *nsObject)
static void formatInputMethodQueryEvent(QDebug d, const QInputMethodQueryEvent *e)
static void formatInputMethodEvent(QDebug d, const QInputMethodEvent *e)
#define Q_IMPL_POINTER_EVENT(Class)
static void formatUnicodeString(QDebug d, const QString &s)
static const char * eventClassName(QEvent::Type t)
static QDebug operator<<(QDebug dbg, const QInputMethodEvent::Attribute &attr)
static void formatTouchEvent(QDebug d, const QTouchEvent &t)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)