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
2046#if QT_DEPRECATED_SINCE(6
, 13
)
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos,
const QPoint &globalPos,
2061 Qt::KeyboardModifiers modifiers)
2062 : QContextMenuEvent(pos, globalPos, modifiers,
2063 reason == Keyboard ? QInputDevice::primaryKeyboard()
2064 : QPointingDevice::primaryPointingDevice())
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088QContextMenuEvent::QContextMenuEvent(
const QPoint &pos,
const QPoint &globalPos,
2089 Qt::KeyboardModifiers modifiers,
const QInputDevice *device)
2090 : QInputEvent(ContextMenu, device, modifiers), m_pos(pos), m_globalPos(globalPos),
2096 switch (device->type()) {
2097 case QInputDevice::DeviceType::Keyboard:
2098 m_reason = Keyboard;
2100 case QInputDevice::DeviceType::Mouse:
2101 case QInputDevice::DeviceType::TouchScreen:
2102 case QInputDevice::DeviceType::TouchPad:
2103 case QInputDevice::DeviceType::Puck:
2104 case QInputDevice::DeviceType::Stylus:
2105 case QInputDevice::DeviceType::Airbrush:
2115#if QT_DEPRECATED_SINCE(6
, 4
)
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos)
2133 : QContextMenuEvent(pos, QPoint(), Qt::NoModifier,
2134 reason == Keyboard ? QInputDevice::primaryKeyboard()
2135 : QPointingDevice::primaryPointingDevice())
2140 m_globalPos = QCursor::pos();
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2158
2159
2160
2161
2162
2163
2164
2167
2168
2169
2170
2171
2172
2173
2176
2177
2178
2179
2180
2181
2182
2185
2186
2187
2188
2189
2190
2191
2194
2195
2196
2197
2198
2199
2200
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2224
2225
2226
2227
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
2281
2282
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
2334
2335
2336
2337
2338
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2394
2395
2396
2397
2400
2401
2402
2403
2404
2405
2408
2409
2410
2411
2412
2413
2414
2415
2418
2419
2420
2421
2422
2423
2424QInputMethodEvent::QInputMethodEvent()
2425 : QEvent(QEvent::InputMethod), m_replacementStart(0), m_replacementLength(0)
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439QInputMethodEvent::QInputMethodEvent(
const QString &preeditText,
const QList<Attribute> &attributes)
2440 : QEvent(QEvent::InputMethod), m_preedit(preeditText), m_attributes(attributes),
2441 m_replacementStart(0), m_replacementLength(0)
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463void QInputMethodEvent::setCommitString(
const QString &commitString,
int replaceFrom,
int replaceLength)
2465 m_commit = commitString;
2466 m_replacementStart = replaceFrom;
2467 m_replacementLength = replaceLength;
2471
2472
2473
2474
2475
2476
2477
2478
2479
2482
2483
2484
2485
2486
2487
2488
2491
2492
2493
2494
2495
2496
2497
2498
2499
2502
2503
2504
2505
2506
2507
2508
2511
2512
2513
2514
2515
2516
2517
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2538
2539
2540
2541
2544
2545
2546QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries)
2547 : QEvent(InputMethodQuery),
2555
2556
2557void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query,
const QVariant &value)
2559 for (
int i = 0; i < m_values.size(); ++i) {
2560 if (m_values.at(i).query == query) {
2561 m_values[i].value = value;
2565 QueryPair pair = { query, value };
2566 m_values.append(pair);
2570
2571
2572QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query)
const
2574 for (
int i = 0; i < m_values.size(); ++i)
2575 if (m_values.at(i).query == query)
2576 return m_values.at(i).value;
2580#if QT_CONFIG(tabletevent)
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
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
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688QTabletEvent::QTabletEvent(Type type,
const QPointingDevice *dev,
const QPointF &pos,
const QPointF &globalPos,
2689 qreal pressure,
float xTilt,
float yTilt,
2690 float tangentialPressure, qreal rotation,
float z,
2691 Qt::KeyboardModifiers keyState,
2692 Qt::MouseButton button, Qt::MouseButtons buttons)
2693 : QSinglePointEvent(type, dev, pos, pos, globalPos, button, buttons, keyState),
2694 m_tangential(tangentialPressure),
2699 QEventPoint &p = point(0);
2700 QMutableEventPoint::setPressure(p, pressure);
2701 QMutableEventPoint::setRotation(p, rotation);
2704Q_IMPL_POINTER_EVENT(QTabletEvent)
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2721
2722
2723
2724
2725
2726
2727
2728
2729
2732
2733
2734
2735
2736
2737
2738
2741
2742
2743
2744
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
2778
2779
2780
2783
2784
2785
2786
2787
2788
2789
2790
2793
2794
2795
2796
2797
2798
2799
2800
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2828
2829
2830
2831
2832
2833
2834
2835
2838
2839
2840
2841
2842
2843
2844
2845
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2899#ifndef QT_NO_GESTURES
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2965#if QT_DEPRECATED_SINCE(6
, 2
)
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
2984 const QPointF &localPos,
const QPointF &scenePos,
2985 const QPointF &globalPos, qreal realValue, quint64 sequenceId,
2987 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2988 Qt::NoButton, Qt::NoModifier),
2989 m_sequenceId(sequenceId), m_realValue(realValue), m_gestureType(type)
2991 if (qIsNull(realValue) && intValue != 0)
2992 m_realValue = intValue;
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
int fingerCount,
3020 const QPointF &localPos,
const QPointF &scenePos,
3021 const QPointF &globalPos, qreal value,
const QPointF &delta,
3023 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
3024 Qt::NoButton, Qt::NoModifier),
3025 m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
3027 Q_ASSERT(fingerCount < 16);
3033
3034
3035
3036
3037
3040
3041
3042
3043
3044
3045
3046
3049
3050
3051
3052
3053
3054
3055
3056
3057
3060
3061
3062
3063
3064
3065
3066
3067
3068
3071
3072
3073
3074
3075
3076
3079
3080
3081
3082
3083
3084
3085
3088
3089
3090
3091
3092
3093
3094
3097
3098
3099
3100
3101
3102
3105
3106
3107
3108
3109
3110
3111
3114#if QT_CONFIG(draganddrop)
3116#if QT_DEPRECATED_SINCE(6
, 16
)
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130QDragMoveEvent::QDragMoveEvent(
const QPoint& pos, Qt::DropActions actions,
const QMimeData *data,
3131 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3132 : QDropEvent(QPointF(pos), actions, data, buttons, modifiers, type)
3133 , m_rect(pos, QSize(1, 1))
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149QDragMoveEvent::QDragMoveEvent(QPointF pos, Qt::DropActions actions,
const QMimeData *data,
3150 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3151 : QDropEvent(pos, actions, data, buttons, modifiers, type)
3152 , m_rect(pos.toPoint(), QSize(1, 1))
3155Q_IMPL_EVENT_COMMON(QDragMoveEvent)
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3171
3172
3173
3174
3175
3176
3179
3180
3181
3182
3183
3184
3187
3188
3189
3190
3191
3192
3195
3196
3197
3198
3199
3200
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3239
3240
3241
3242
3243
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257QDropEvent::QDropEvent(
const QPointF& pos, Qt::DropActions actions,
const QMimeData *data,
3258 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3259 : QEvent(type), m_pos(pos), m_mouseState(buttons),
3260 m_modState(modifiers), m_actions(actions),
3263 m_defaultAction = m_dropAction =
3264 QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(m_actions, modifiers);
3268Q_IMPL_EVENT_COMMON(QDropEvent)
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282QObject* QDropEvent::source()
const
3284 if (
const QDragManager *manager = QDragManager::self())
3285 return manager->source();
3290void QDropEvent::setDropAction(Qt::DropAction action)
3292 if (!(action & m_actions) && action != Qt::IgnoreAction)
3293 action = m_defaultAction;
3294 m_dropAction = action;
3298
3299
3300
3301
3302
3305
3306
3307
3308
3309
3312
3313
3314
3315
3316
3319
3320
3321
3322
3323
3326
3327
3328
3329
3330
3333
3334
3335
3336
3337
3340
3341
3342
3343
3344
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3363
3364
3365
3366
3367
3368
3369
3370
3373
3374
3375
3376
3377
3378
3381
3382
3383
3384
3385
3386
3389
3390
3391
3392
3393
3394
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3417#if QT_DEPRECATED_SINCE(6
, 16
)
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431QDragEnterEvent::QDragEnterEvent(
const QPoint& point, Qt::DropActions actions,
const QMimeData *data,
3432 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3433 : QDragMoveEvent(QPointF(point), actions, data, buttons, modifiers, DragEnter)
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449QDragEnterEvent::QDragEnterEvent(QPointF point, Qt::DropActions actions,
const QMimeData *data,
3450 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3451 : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
3454Q_IMPL_EVENT_COMMON(QDragEnterEvent)
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3499
3500
3501
3502
3503
3504QDragLeaveEvent::QDragLeaveEvent()
3508Q_IMPL_EVENT_COMMON(QDragLeaveEvent)
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3529
3530
3531
3532
3533
3534
3535
3536
3537QHelpEvent::QHelpEvent(Type type,
const QPoint &pos,
const QPoint &globalPos)
3538 : QEvent(type), m_pos(pos), m_globalPos(globalPos)
3542
3543
3544
3545
3546
3547
3550
3551
3552
3553
3554
3555
3558
3559
3560
3561
3562
3563
3566
3567
3568
3569
3570
3571
3574
3575
3576
3577
3578
3579
3580
3583
3584
3585
3586
3587
3588
3589
3593#ifndef QT_NO_STATUSTIP
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3638
3639
3640
3641
3642QStatusTipEvent::QStatusTipEvent(
const QString &tip)
3643 : QEvent(StatusTip), m_tip(tip)
3649
3650
3651
3652
3653
3654
3658#if QT_CONFIG(whatsthis)
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3673
3674
3675
3676
3677
3678QWhatsThisClickedEvent::QWhatsThisClickedEvent(
const QString &href)
3679 : QEvent(WhatsThisClicked), m_href(href)
3682Q_IMPL_EVENT_COMMON(QWhatsThisClickedEvent)
3685
3686
3687
3688
3689
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3713
3714
3715
3716
3717
3718
3719
3720QActionEvent::QActionEvent(
int type, QAction *action, QAction *before)
3721 : QEvent(
static_cast<QEvent::Type>(type)), m_action(action), m_before(before)
3724Q_IMPL_EVENT_COMMON(QActionEvent)
3727
3728
3729
3730
3731
3732
3735
3736
3737
3738
3739
3740
3741
3742
3743
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3768
3769
3770QHideEvent::QHideEvent()
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3794
3795
3796QShowEvent::QShowEvent()
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3847
3848
3849
3850
3851QFileOpenEvent::QFileOpenEvent(
const QString &file)
3852 : QEvent(FileOpen), m_file(file), m_url(QUrl::fromLocalFile(file))
3857
3858
3859
3860
3861QFileOpenEvent::QFileOpenEvent(
const QUrl &url)
3862 : QEvent(FileOpen), m_file(url.toLocalFile()), m_url(url)
3869
3870
3871
3872
3873
3874
3877
3878
3879
3880
3881
3882
3884#if QT_DEPRECATED_SINCE(6
, 6
)
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags)
const
3899 file.setFileName(m_file);
3900 return file.open(flags);
3904#ifndef QT_NO_TOOLBAR
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3921
3922
3923
3924
3925QToolBarChangeEvent::QToolBarChangeEvent(
bool t)
3926 : QEvent(ToolBarChange), m_toggle(t)
3932
3933
3934
3937
3938
3939
3940
3941
3942
3943
3944
3948#if QT_CONFIG(shortcut)
3951
3952
3953
3954
3955
3956
3957
3958
3959QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
int id,
bool ambiguous)
3960 : QEvent(Shortcut), m_sequence(key), m_shortcutId(id), m_ambiguous(ambiguous)
3965
3966
3967
3968
3969
3970
3971
3972QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
const QShortcut *shortcut,
bool ambiguous)
3973 : QEvent(Shortcut), m_sequence(key), m_shortcutId(0), m_ambiguous(ambiguous)
3976 auto priv =
static_cast<
const QShortcutPrivate *>(QShortcutPrivate::get(shortcut));
3977 auto index = priv->sc_sequences.indexOf(key);
3979 qWarning() <<
"Given QShortcut does not contain key-sequence " << key;
3982 m_shortcutId = priv->sc_ids[index];
3986Q_IMPL_EVENT_COMMON(QShortcutEvent)
3990#ifndef QT_NO_DEBUG_STREAM
3994 d <<
"QTouchEvent(";
3995 QtDebugUtils::formatQEnum(d, t.type());
3996 d <<
" device: " << t.device()->name();
3998 QtDebugUtils::formatQFlags(d, t.touchPointStates());
3999 d <<
", " << t.points().size() <<
" points: " << t.points() <<
')';
4004 d <<
'"' << Qt::hex;
4005 for (
int i = 0; i < s.size(); ++i) {
4008 d <<
"U+" << s.at(i).unicode();
4010 d << Qt::dec <<
'"';
4015 dbg <<
"[type= " << attr.type <<
", start=" << attr.start <<
", length=" << attr.length
4016 <<
", value=" << attr.value <<
']';
4022 d <<
"QInputMethodEvent(";
4023 if (!e->preeditString().isEmpty()) {
4025 formatUnicodeString(d, e->preeditString());
4027 if (!e->commitString().isEmpty()) {
4029 formatUnicodeString(d, e->commitString());
4031 if (e->replacementLength()) {
4032 d <<
", replacementStart=" << e->replacementStart() <<
", replacementLength="
4033 << e->replacementLength();
4035 const auto attributes = e->attributes();
4036 auto it = attributes.cbegin();
4037 const auto end = attributes.cend();
4039 d <<
", attributes= {";
4042 for (; it != end; ++it)
4051 QDebugStateSaver saver(d);
4053 const Qt::InputMethodQueries queries = e->queries();
4054 d <<
"QInputMethodQueryEvent(queries=" << Qt::showbase << Qt::hex <<
int(queries)
4055 << Qt::noshowbase << Qt::dec <<
", {";
4056 for (
unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
4057 if (queries & mask) {
4058 const Qt::InputMethodQuery query =
static_cast<Qt::InputMethodQuery>(mask);
4059 const QVariant value = e->value(query);
4060 if (value.isValid()) {
4062 QtDebugUtils::formatQEnum(d, query);
4064 if (query == Qt::ImHints)
4065 QtDebugUtils::formatQFlags(d, Qt::InputMethodHints(value.toInt()));
4067 d << value.toString();
4078 case QEvent::ActionAdded:
4079 case QEvent::ActionRemoved:
4080 case QEvent::ActionChanged:
4081 return "QActionEvent";
4082 case QEvent::MouseButtonPress:
4083 case QEvent::MouseButtonRelease:
4084 case QEvent::MouseButtonDblClick:
4085 case QEvent::MouseMove:
4086 case QEvent::NonClientAreaMouseMove:
4087 case QEvent::NonClientAreaMouseButtonPress:
4088 case QEvent::NonClientAreaMouseButtonRelease:
4089 case QEvent::NonClientAreaMouseButtonDblClick:
4090 return "QMouseEvent";
4091 case QEvent::DragEnter:
4092 return "QDragEnterEvent";
4093 case QEvent::DragMove:
4094 return "QDragMoveEvent";
4096 return "QDropEvent";
4097 case QEvent::KeyPress:
4098 case QEvent::KeyRelease:
4099 case QEvent::ShortcutOverride:
4101 case QEvent::FocusIn:
4102 case QEvent::FocusOut:
4103 case QEvent::FocusAboutToChange:
4104 return "QFocusEvent";
4105 case QEvent::ChildAdded:
4106 case QEvent::ChildPolished:
4107 case QEvent::ChildRemoved:
4108 return "QChildEvent";
4110 return "QPaintEvent";
4112 return "QMoveEvent";
4113 case QEvent::Resize:
4114 return "QResizeEvent";
4116 return "QShowEvent";
4118 return "QHideEvent";
4120 return "QEnterEvent";
4122 return "QCloseEvent";
4123 case QEvent::FileOpen:
4124 return "QFileOpenEvent";
4125#ifndef QT_NO_GESTURES
4126 case QEvent::NativeGesture:
4127 return "QNativeGestureEvent";
4128 case QEvent::Gesture:
4129 case QEvent::GestureOverride:
4130 return "QGestureEvent";
4132 case QEvent::HoverEnter:
4133 case QEvent::HoverLeave:
4134 case QEvent::HoverMove:
4135 return "QHoverEvent";
4136 case QEvent::TabletEnterProximity:
4137 case QEvent::TabletLeaveProximity:
4138 case QEvent::TabletPress:
4139 case QEvent::TabletMove:
4140 case QEvent::TabletRelease:
4141 return "QTabletEvent";
4142 case QEvent::StatusTip:
4143 return "QStatusTipEvent";
4144 case QEvent::ToolTip:
4145 return "QHelpEvent";
4146 case QEvent::WindowStateChange:
4147 return "QWindowStateChangeEvent";
4149 return "QWheelEvent";
4150 case QEvent::TouchBegin:
4151 case QEvent::TouchUpdate:
4152 case QEvent::TouchEnd:
4153 return "QTouchEvent";
4154 case QEvent::Shortcut:
4155 return "QShortcutEvent";
4156 case QEvent::InputMethod:
4157 return "QInputMethodEvent";
4158 case QEvent::InputMethodQuery:
4159 return "QInputMethodQueryEvent";
4160 case QEvent::OrientationChange:
4161 return "QScreenOrientationChangeEvent";
4162 case QEvent::ScrollPrepare:
4163 return "QScrollPrepareEvent";
4164 case QEvent::Scroll:
4165 return "QScrollEvent";
4166 case QEvent::GraphicsSceneMouseMove:
4167 case QEvent::GraphicsSceneMousePress:
4168 case QEvent::GraphicsSceneMouseRelease:
4169 case QEvent::GraphicsSceneMouseDoubleClick:
4170 return "QGraphicsSceneMouseEvent";
4171 case QEvent::GraphicsSceneContextMenu:
4172 case QEvent::GraphicsSceneHoverEnter:
4173 case QEvent::GraphicsSceneHoverMove:
4174 case QEvent::GraphicsSceneHoverLeave:
4175 case QEvent::GraphicsSceneHelp:
4176 case QEvent::GraphicsSceneDragEnter:
4177 case QEvent::GraphicsSceneDragMove:
4178 case QEvent::GraphicsSceneDragLeave:
4179 case QEvent::GraphicsSceneDrop:
4180 case QEvent::GraphicsSceneWheel:
4181 return "QGraphicsSceneEvent";
4183 return "QTimerEvent";
4184 case QEvent::PlatformSurface:
4185 return "QPlatformSurfaceEvent";
4192# if QT_CONFIG(draganddrop)
4194static void formatDropEvent(QDebug d,
const QDropEvent *e)
4196 const QEvent::Type type = e->type();
4197 d << eventClassName(type) <<
"(dropAction=";
4198 QtDebugUtils::formatQEnum(d, e->dropAction());
4199 d <<
", proposedAction=";
4200 QtDebugUtils::formatQEnum(d, e->proposedAction());
4201 d <<
", possibleActions=";
4202 QtDebugUtils::formatQFlags(d, e->possibleActions());
4204 QtDebugUtils::formatQPoint(d, e->position());
4205 if (type == QEvent::DragMove || type == QEvent::DragEnter)
4206 d <<
", answerRect=" <<
static_cast<
const QDragMoveEvent *>(e)->answerRect();
4207 d <<
", formats=" << e->mimeData()->formats();
4208 QtDebugUtils::formatNonNullQFlags(d,
", keyboardModifiers=", e->modifiers());
4210 QtDebugUtils::formatQFlags(d, e->buttons());
4215# if QT_CONFIG(tabletevent)
4217static void formatTabletEvent(QDebug d,
const QTabletEvent *e)
4219 const QEvent::Type type = e->type();
4221 d << eventClassName(type) <<
'(';
4222 QtDebugUtils::formatQEnum(d, type);
4224 QtDebugUtils::formatQFlags(d, e->buttons());
4226 QtDebugUtils::formatQPoint(d, e->position());
4227 d <<
" z=" << e->z()
4228 <<
" xTilt=" << e->xTilt()
4229 <<
" yTilt=" << e->yTilt();
4230 if (type == QEvent::TabletPress || type == QEvent::TabletMove)
4231 d <<
" pressure=" << e->pressure();
4232 if (e->device()->hasCapability(QInputDevice::Capability::Rotation))
4233 d <<
" rotation=" << e->rotation();
4234 if (e->deviceType() == QInputDevice::DeviceType::Airbrush)
4235 d <<
" tangentialPressure=" << e->tangentialPressure();
4236 d <<
" dev=" << e->device() <<
')';
4244 return dbg <<
"QEventPoint(0x0)";
4246 return operator<<(dbg, *tp);
4251 QDebugStateSaver saver(dbg);
4253 dbg <<
"QEventPoint(id=" << tp.id() <<
" ts=" << tp.timestamp();
4255 QtDebugUtils::formatQPoint(dbg, tp.position());
4257 QtDebugUtils::formatQPoint(dbg, tp.scenePosition());
4259 QtDebugUtils::formatQPoint(dbg, tp.globalPosition());
4261 QtDebugUtils::formatQEnum(dbg, tp.state());
4262 if (!qFuzzyIsNull(tp.pressure()) && !qFuzzyCompare(tp.pressure(), 1))
4263 dbg <<
" pressure=" << tp.pressure();
4264 if (!tp.ellipseDiameters().isEmpty() || !qFuzzyIsNull(tp.rotation())) {
4266 << tp.ellipseDiameters().width() <<
"x" << tp.ellipseDiameters().height()
4267 <<
" \u2221 " << tp.rotation() <<
')';
4270 QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF());
4272 QtDebugUtils::formatQPoint(dbg, tp.pressPosition());
4274 QtDebugUtils::formatQPoint(dbg, tp.lastPosition());
4276 QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPosition());
4283 QDebugStateSaver saver(dbg);
4286 return dbg <<
"QEvent(0x0)";
4289 const QEvent::Type type = e->type();
4290 bool isMouse =
false;
4292 case QEvent::Expose:
4293 dbg <<
"QExposeEvent()";
4296 dbg <<
"QPaintEvent(" <<
static_cast<
const QPaintEvent *>(e)->region() <<
')';
4298 case QEvent::MouseButtonPress:
4299 case QEvent::MouseMove:
4300 case QEvent::MouseButtonRelease:
4301 case QEvent::MouseButtonDblClick:
4302 case QEvent::NonClientAreaMouseButtonPress:
4303 case QEvent::NonClientAreaMouseMove:
4304 case QEvent::NonClientAreaMouseButtonRelease:
4305 case QEvent::NonClientAreaMouseButtonDblClick:
4308 case QEvent::HoverEnter:
4309 case QEvent::HoverMove:
4310 case QEvent::HoverLeave:
4312 const QSinglePointEvent *spe =
static_cast<
const QSinglePointEvent*>(e);
4313 const Qt::MouseButton button = spe->button();
4314 const Qt::MouseButtons buttons = spe->buttons();
4315 dbg << eventClassName(type) <<
'(';
4316 QtDebugUtils::formatQEnum(dbg, type);
4317 if (dbg.verbosity() > QDebug::DefaultVerbosity)
4318 dbg <<
" ts=" << spe->timestamp();
4320 if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
4322 QtDebugUtils::formatQEnum(dbg, button);
4324 if (buttons && button != buttons) {
4326 QtDebugUtils::formatQFlags(dbg, buttons);
4329 QtDebugUtils::formatNonNullQFlags(dbg,
", ", spe->modifiers());
4331 QtDebugUtils::formatQPoint(dbg, spe->position());
4333 QtDebugUtils::formatQPoint(dbg, spe->scenePosition());
4335 QtDebugUtils::formatQPoint(dbg, spe->globalPosition());
4336 dbg <<
" dev=" << spe->device() <<
')';
4338 auto src =
static_cast<
const QMouseEvent*>(e)->source();
4339 if (src != Qt::MouseEventNotSynthesized) {
4341 QtDebugUtils::formatQEnum(dbg, src);
4346# if QT_CONFIG(wheelevent)
4347 case QEvent::Wheel: {
4348 const QWheelEvent *we =
static_cast<
const QWheelEvent *>(e);
4349 dbg <<
"QWheelEvent(" << we->phase();
4350 if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
4351 dbg <<
", pixelDelta=" << we->pixelDelta() <<
", angleDelta=" << we->angleDelta();
4352 dbg <<
" dev=" << we->device() <<
')';
4357 case QEvent::KeyPress:
4358 case QEvent::KeyRelease:
4359 case QEvent::ShortcutOverride:
4361 const QKeyEvent *ke =
static_cast<
const QKeyEvent *>(e);
4362 dbg <<
"QKeyEvent(";
4363 QtDebugUtils::formatQEnum(dbg, type);
4365 QtDebugUtils::formatQEnum(dbg,
static_cast<Qt::Key>(ke->key()));
4366 QtDebugUtils::formatNonNullQFlags(dbg,
", ", ke->modifiers());
4367 if (!ke->text().isEmpty())
4368 dbg <<
", text=" << ke->text();
4369 if (ke->isAutoRepeat())
4370 dbg <<
", autorepeat, count=" << ke->count();
4371 if (dbg.verbosity() > QDebug::DefaultVerbosity) {
4372 dbg <<
", nativeScanCode=" << ke->nativeScanCode();
4373 dbg <<
", nativeVirtualKey=" << ke->nativeVirtualKey();
4378#if QT_CONFIG(shortcut)
4379 case QEvent::Shortcut: {
4380 const QShortcutEvent *se =
static_cast<
const QShortcutEvent *>(e);
4381 dbg <<
"QShortcutEvent(" << se->key().toString() <<
", id=" << se->shortcutId();
4382 if (se->isAmbiguous())
4383 dbg <<
", ambiguous";
4388 case QEvent::FocusAboutToChange:
4389 case QEvent::FocusIn:
4390 case QEvent::FocusOut:
4391 dbg <<
"QFocusEvent(";
4392 QtDebugUtils::formatQEnum(dbg, type);
4394 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QFocusEvent *>(e)->reason());
4397 case QEvent::Move: {
4398 const QMoveEvent *me =
static_cast<
const QMoveEvent *>(e);
4399 dbg <<
"QMoveEvent(";
4400 QtDebugUtils::formatQPoint(dbg, me->pos());
4401 if (!me->spontaneous())
4402 dbg <<
", non-spontaneous";
4406 case QEvent::Resize: {
4407 const QResizeEvent *re =
static_cast<
const QResizeEvent *>(e);
4408 dbg <<
"QResizeEvent(";
4409 QtDebugUtils::formatQSize(dbg, re->size());
4410 if (!re->spontaneous())
4411 dbg <<
", non-spontaneous";
4415# if QT_CONFIG(draganddrop)
4416 case QEvent::DragEnter:
4417 case QEvent::DragMove:
4419 formatDropEvent(dbg,
static_cast<
const QDropEvent *>(e));
4422 case QEvent::InputMethod:
4423 formatInputMethodEvent(dbg,
static_cast<
const QInputMethodEvent *>(e));
4425 case QEvent::InputMethodQuery:
4426 formatInputMethodQueryEvent(dbg,
static_cast<
const QInputMethodQueryEvent *>(e));
4428 case QEvent::TouchBegin:
4429 case QEvent::TouchUpdate:
4430 case QEvent::TouchEnd:
4431 formatTouchEvent(dbg, *
static_cast<
const QTouchEvent*>(e));
4433 case QEvent::ChildAdded:
4434 case QEvent::ChildPolished:
4435 case QEvent::ChildRemoved:
4436 dbg <<
"QChildEvent(";
4437 QtDebugUtils::formatQEnum(dbg, type);
4438 dbg <<
", " << (
static_cast<
const QChildEvent*>(e))->child() <<
')';
4440# ifndef QT_NO_GESTURES
4441 case QEvent::NativeGesture: {
4442 const QNativeGestureEvent *ne =
static_cast<
const QNativeGestureEvent *>(e);
4443 dbg <<
"QNativeGestureEvent(";
4444 QtDebugUtils::formatQEnum(dbg, ne->gestureType());
4445 if (dbg.verbosity() > QDebug::DefaultVerbosity)
4446 dbg <<
", ts=" << ne->timestamp();
4447 dbg <<
", fingerCount=" << ne->fingerCount() <<
", localPos=";
4448 QtDebugUtils::formatQPoint(dbg, ne->position());
4449 if (!qIsNull(ne->value()))
4450 dbg <<
", value=" << ne->value();
4451 if (!ne->delta().isNull()) {
4453 QtDebugUtils::formatQPoint(dbg, ne->delta());
4459 case QEvent::ApplicationStateChange:
4460 dbg <<
"QApplicationStateChangeEvent(";
4461 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QApplicationStateChangeEvent *>(e)->applicationState());
4464# ifndef QT_NO_CONTEXTMENU
4465 case QEvent::ContextMenu:
4466 dbg <<
"QContextMenuEvent(" <<
static_cast<
const QContextMenuEvent *>(e)->pos() <<
')';
4469# if QT_CONFIG(tabletevent)
4470 case QEvent::TabletEnterProximity:
4471 case QEvent::TabletLeaveProximity:
4472 case QEvent::TabletPress:
4473 case QEvent::TabletMove:
4474 case QEvent::TabletRelease:
4475 formatTabletEvent(dbg,
static_cast<
const QTabletEvent *>(e));
4479 dbg <<
"QEnterEvent(" <<
static_cast<
const QEnterEvent *>(e)->position() <<
')';
4482 dbg <<
"QTimerEvent(id=" <<
static_cast<
const QTimerEvent *>(e)->timerId() <<
')';
4484 case QEvent::PlatformSurface:
4485 dbg <<
"QPlatformSurfaceEvent(surfaceEventType=";
4486 switch (
static_cast<
const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {
4487 case QPlatformSurfaceEvent::SurfaceCreated:
4488 dbg <<
"SurfaceCreated";
4490 case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
4491 dbg <<
"SurfaceAboutToBeDestroyed";
4496 case QEvent::ScrollPrepare: {
4497 const QScrollPrepareEvent *se =
static_cast<
const QScrollPrepareEvent *>(e);
4498 dbg <<
"QScrollPrepareEvent(viewportSize=" << se->viewportSize()
4499 <<
", contentPosRange=" << se->contentPosRange()
4500 <<
", contentPos=" << se->contentPos() <<
')';
4503 case QEvent::Scroll: {
4504 const QScrollEvent *se =
static_cast<
const QScrollEvent *>(e);
4505 dbg <<
"QScrollEvent(contentPos=" << se->contentPos()
4506 <<
", overshootDistance=" << se->overshootDistance()
4507 <<
", scrollState=" << se->scrollState() <<
')';
4511 dbg << eventClassName(type) <<
'(';
4512 QtDebugUtils::formatQEnum(dbg, type);
4513 dbg <<
", " << (
const void *)e <<
')';
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4535
4536
4537
4538
4541
4542
4543
4544
4545
4546
4547
4548
4549
4552
4553
4554
4555
4556
4557
4558
4561
4562
4563
4564
4565
4566
4567
4570
4571
4572
4575
4576QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates oldState,
bool isOverride)
4577 : QEvent(WindowStateChange), m_oldStates(oldState), m_override(isOverride)
4582
4583bool QWindowStateChangeEvent::isOverride()
const
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
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4723
4724
4725
4727QTouchEvent::QTouchEvent(QEvent::Type eventType,
4728 const QPointingDevice *device,
4729 Qt::KeyboardModifiers modifiers,
4730 const QList<QEventPoint> &touchPoints)
4731 : QPointerEvent(eventType, device, modifiers, touchPoints),
4734 for (QEventPoint &point : m_points) {
4735 m_touchPointStates |= point.state();
4736 QMutableEventPoint::setDevice(point, device);
4740#if QT_DEPRECATED_SINCE(6
, 0
)
4742
4743
4744
4745
4746
4747
4748QTouchEvent::QTouchEvent(QEvent::Type eventType,
4749 const QPointingDevice *device,
4750 Qt::KeyboardModifiers modifiers,
4751 QEventPoint::States touchPointStates,
4752 const QList<QEventPoint> &touchPoints)
4753 : QPointerEvent(eventType, device, modifiers, touchPoints),
4755 m_touchPointStates(touchPointStates)
4757 for (QEventPoint &point : m_points)
4758 QMutableEventPoint::setDevice(point, device);
4765
4766
4767bool QTouchEvent::isBeginEvent()
const
4769 return m_touchPointStates.testFlag(QEventPoint::State::Pressed);
4773
4774
4775
4776bool QTouchEvent::isUpdateEvent()
const
4778 return !m_touchPointStates.testFlag(QEventPoint::State::Pressed) &&
4779 !m_touchPointStates.testFlag(QEventPoint::State::Released);
4783
4784
4785bool QTouchEvent::isEndEvent()
const
4787 return m_touchPointStates.testFlag(QEventPoint::State::Released);
4791
4792
4793
4794
4797
4798
4799
4802
4803
4804
4805
4806
4807
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4828
4829
4830
4831QScrollPrepareEvent::QScrollPrepareEvent(
const QPointF &startPos)
4832 : QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
4839
4840
4841
4842
4845
4846
4847
4848
4849
4852
4853
4854
4857
4858
4859
4862
4863
4864
4865
4866void QScrollPrepareEvent::setViewportSize(
const QSizeF &size)
4868 m_viewportSize = size;
4872
4873
4874
4875
4876void QScrollPrepareEvent::setContentPosRange(
const QRectF &rect)
4878 m_contentPosRange = rect;
4882
4883
4884
4885
4886void QScrollPrepareEvent::setContentPos(
const QPointF &pos)
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4924
4925
4926
4927
4928
4929QScrollEvent::QScrollEvent(
const QPointF &contentPos,
const QPointF &overshootDistance, ScrollState scrollState)
4930 : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)
4937
4938
4939
4940
4943
4944
4945
4946
4947
4948
4949
4952
4953
4954
4955
4956
4957
4958
4959
4960
4963
4964
4965
4966QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation)
4967 : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)
4974
4975
4976
4977
4980
4981
4982
4983
4986
4987
4988
4989QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState applicationState)
4990 : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState)
4997
4998
4999
5000
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5022
5023
5024
5025
5026
5027
5028
5029QChildWindowEvent::QChildWindowEvent(Type type, QWindow *childWindow)
5030 : QEvent(type), c(childWindow)
5037
5038
5039
5040
5042QMutableTouchEvent::~QMutableTouchEvent()
5046
5047
5048void QMutableTouchEvent::addPoint(QTouchEvent *e,
const QEventPoint &point)
5050 e->m_points.append(point);
5051 auto &added = e->m_points.last();
5052 if (!added.device())
5053 QMutableEventPoint::setDevice(added, e->pointingDevice());
5054 e->m_touchPointStates |= point.state();
5058QMutableSinglePointEvent::~QMutableSinglePointEvent()
5062
5063
5064void QMutableTouchEvent::addPoint(
const QEventPoint &point)
5066 addPoint(
this, point);
5071#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)