7#include "private/qguiapplication_p.h"
8#include "private/qinputdevice_p.h"
9#include "private/qpointingdevice_p.h"
10#include "qpa/qplatformintegration.h"
11#include "private/qevent_p.h"
12#include "private/qeventpoint_p.h"
23#if QT_CONFIG(draganddrop)
24#include <qpa/qplatformdrag.h>
25#include <private/qdnd_p.h>
28#if QT_CONFIG(shortcut)
29#include <private/qshortcut_p.h>
32#include <private/qdebug_p.h>
34#define Q_IMPL_POINTER_EVENT(Class)
35 Class::Class(const Class &) = default;
36 Class::~Class() = default;
37 Class* Class::clone() const
39 auto c = new Class(*this);
40 for (auto &point : c->m_points)
41 QMutableEventPoint::detach(point);
44 Q_ASSERT(reinterpret_cast<quintptr>(c) == reinterpret_cast<quintptr>(e));
52static_assert(
sizeof(QMutableTouchEvent) ==
sizeof(QTouchEvent));
54static_assert(
sizeof(QMouseEvent) ==
sizeof(QSinglePointEvent));
55static_assert(
sizeof(QVector2D) ==
sizeof(quint64));
58
59
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76QEnterEvent::QEnterEvent(
const QPointF &localPos,
const QPointF &scenePos,
const QPointF &globalPos,
const QPointingDevice *device)
77 : QSinglePointEvent(QEvent::Enter, device, localPos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier)
84
85
86
87
88
90
91
92
93
94
96
97
98
99
100
102
103
104
105
106
108
109
110
111
112
114
115
116
117
118
120
121
122
123
124
126
127
128
129
130
132
133
134
135
136
139
140
141
142
143
144
145
148
149
150QInputEvent::QInputEvent(Type type,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
151 : QEvent(type, QEvent::InputEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
155
156
157QInputEvent::QInputEvent(QEvent::Type type, QEvent::PointerEventTag,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
158 : QEvent(type, QEvent::PointerEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
162
163
164QInputEvent::QInputEvent(QEvent::Type type, QEvent::SinglePointEventTag,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
165 : QEvent(type, QEvent::SinglePointEventTag{}), m_dev(dev), m_modState(modifiers), m_reserved(0)
171
172
173
174
175
176
177
178
179
180
181
182
183
184
187
188
189
190
193
194
195
196
197
198
199
202
203
204
205
206
209
210
211
212
213
214
217
218
219
220
221
224
225
226
227
228
229
232
233
234
235
238
239
240QEventPoint &QPointerEvent::point(qsizetype i)
246
247
248
249
252
253
254
255
258
259
260QPointerEvent::QPointerEvent(QEvent::Type type,
const QPointingDevice *dev,
261 Qt::KeyboardModifiers modifiers,
const QList<QEventPoint> &points)
262 : QInputEvent(type, QEvent::PointerEventTag{}, dev, modifiers), m_points(points)
267
268
269QPointerEvent::QPointerEvent(QEvent::Type type, QEvent::SinglePointEventTag,
const QInputDevice *dev, Qt::KeyboardModifiers modifiers)
270 : QInputEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers)
277
278
279
280QEventPoint *QPointerEvent::pointById(
int id)
282 for (
auto &p : m_points) {
290
291
292
293bool QPointerEvent::allPointsGrabbed()
const
295 for (
const auto &p : points()) {
296 if (!exclusiveGrabber(p) && passiveGrabbers(p).isEmpty())
303
304
305
306bool QPointerEvent::allPointsAccepted()
const
308 for (
const auto &p : points()) {
316
317
318void QPointerEvent::setAccepted(
bool accepted)
320 QEvent::setAccepted(accepted);
321 for (
auto &p : m_points)
322 p.setAccepted(accepted);
326
327
328
329
330const QPointingDevice *QPointerEvent::pointingDevice()
const
332 return static_cast<
const QPointingDevice *>(m_dev);
336
337
338void QPointerEvent::setTimestamp(quint64 timestamp)
340 QInputEvent::setTimestamp(timestamp);
341 for (
auto &p : m_points)
342 QMutableEventPoint::setTimestamp(p, timestamp);
346
347
348
349
350
351QObject *QPointerEvent::exclusiveGrabber(
const QEventPoint &point)
const
353 Q_ASSERT(pointingDevice());
354 auto persistentPoint = QPointingDevicePrivate::get(pointingDevice())->queryPointById(point.id());
355 if (Q_UNLIKELY(!persistentPoint)) {
356 qWarning() <<
"point is not in activePoints" << point;
359 return persistentPoint->exclusiveGrabber;
363
364
365
366
367
368
369void QPointerEvent::setExclusiveGrabber(
const QEventPoint &point, QObject *exclusiveGrabber)
371 Q_ASSERT(pointingDevice());
372 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
373 devPriv->setExclusiveGrabber(
this, point, exclusiveGrabber);
377
378
379
380
381
382
383
384QList<QPointer<QObject> > QPointerEvent::passiveGrabbers(
const QEventPoint &point)
const
386 Q_ASSERT(pointingDevice());
387 auto persistentPoint = QPointingDevicePrivate::get(pointingDevice())->queryPointById(point.id());
388 if (Q_UNLIKELY(!persistentPoint)) {
389 qWarning() <<
"point is not in activePoints" << point;
392 return persistentPoint->passiveGrabbers;
396
397
398
399
400
401
402
403
404bool QPointerEvent::addPassiveGrabber(
const QEventPoint &point, QObject *grabber)
406 Q_ASSERT(pointingDevice());
407 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
408 return devPriv->addPassiveGrabber(
this, point, grabber);
412
413
414
415
416
417
418
419bool QPointerEvent::removePassiveGrabber(
const QEventPoint &point, QObject *grabber)
421 Q_ASSERT(pointingDevice());
422 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
423 return devPriv->removePassiveGrabber(
this, point, grabber);
427
428
429
430
431
432
433void QPointerEvent::clearPassiveGrabbers(
const QEventPoint &point)
435 Q_ASSERT(pointingDevice());
436 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
437 devPriv->clearPassiveGrabbers(
this, point);
441
442
443
444
445
446
447
450
451
452
453
454
455
456
457
458
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
480
481
482
483
484
485
486
487
488
491
492
493
494
495
496
499
500
501
502
503
504
505
506
507
508
509
510
513
514
515QSinglePointEvent::QSinglePointEvent(QEvent::Type type,
const QPointingDevice *dev,
516 const QPointF &localPos,
const QPointF &scenePos,
const QPointF &globalPos,
517 Qt::MouseButton button, Qt::MouseButtons buttons,
518 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
519 : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
521 m_mouseState(buttons),
523 m_reserved(0), m_reserved2(0),
524 m_doubleClick(
false), m_phase(0), m_invertedScrolling(0)
526 bool isPress = (button != Qt::NoButton && (button | buttons) == buttons);
527 bool isWheel = (type == QEvent::Type::Wheel);
528 auto devPriv = QPointingDevicePrivate::get(
const_cast<QPointingDevice *>(pointingDevice()));
529 auto epd = devPriv->pointById(0);
530 QEventPoint &p = epd->eventPoint;
531 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);
551 QMutableEventPoint::detach(p);
552 QMutableEventPoint::setPosition(p, localPos);
557
558
559
560
561
562
563
564QSinglePointEvent::QSinglePointEvent(QEvent::Type type,
const QPointingDevice *dev,
const QEventPoint &point,
565 Qt::MouseButton button, Qt::MouseButtons buttons,
566 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
567 : QPointerEvent(type, QEvent::SinglePointEventTag{}, dev, modifiers),
569 m_mouseState(buttons),
571 m_reserved(0), m_reserved2(0),
572 m_doubleClick(
false), m_phase(0), m_invertedScrolling(0)
580
581
582bool QSinglePointEvent::isBeginEvent()
const
587 return m_button != Qt::NoButton && m_mouseState.testFlag(m_button)
588 && type() != QEvent::MouseButtonDblClick;
592
593
594bool QSinglePointEvent::isUpdateEvent()
const
598 return m_button == Qt::NoButton || type() == QEvent::MouseButtonDblClick;
602
603
604bool QSinglePointEvent::isEndEvent()
const
606 return m_button != Qt::NoButton && !m_mouseState.testFlag(m_button);
610
611
612
613
614
615
616
617
618
619
620
621
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
669
670
672#if QT_DEPRECATED_SINCE(6
, 4
)
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695QMouseEvent::QMouseEvent(Type type,
const QPointF &localPos, Qt::MouseButton button,
696 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
697 : QSinglePointEvent(type, device, localPos, localPos,
703 button, buttons, modifiers)
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726QMouseEvent::QMouseEvent(Type type,
const QPointF &localPos,
const QPointF &globalPos,
727 Qt::MouseButton button, Qt::MouseButtons buttons,
728 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
729 : QMouseEvent(type, localPos, localPos, globalPos, button, buttons, modifiers, device)
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750QMouseEvent::QMouseEvent(QEvent::Type type,
const QPointF &localPos,
751 const QPointF &scenePos,
const QPointF &globalPos,
752 Qt::MouseButton button, Qt::MouseButtons buttons,
753 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
754 : QSinglePointEvent(type, device, localPos, scenePos, globalPos, button, buttons, modifiers)
758QMouseEvent::QMouseEvent(QEvent::Type type,
const QPointF &localPos,
const QPointF &windowPos,
759 const QPointF &globalPos, Qt::MouseButton button, Qt::MouseButtons buttons,
760 Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source,
761 const QPointingDevice *device)
762 : QSinglePointEvent(type, device, localPos, windowPos, globalPos, button, buttons, modifiers, source)
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
796
797
801Qt::MouseEventSource QMouseEvent::source()
const
803 return Qt::MouseEventSource(m_source);
807
808
809
810
811
812
813
814
815
816Qt::MouseEventFlags QMouseEvent::flags()
const
818 return (m_doubleClick ? Qt::MouseEventCreatedDoubleClick : Qt::NoMouseEventFlag);
822
823
824
825
826
827
828
829
830
831
832
833
834
835
838
839
840
841
842
843
844
845
846
847
850
851
852
853
854
855
856
857
858
859
860
861
862
863
866
867
868
869
870
871
872
873
874
875
878
879
880
881
882
883
884
885
886
887
888
889
892
893
894
895
896
897
898
899
900
901
902
903
906
907
908
909
910
911
912
913
916
917
918
919
920
921
922
923
926
927
928
929
930
931
932
933
936
937
938
939
940
941
942
943
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
991
992
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058QHoverEvent::QHoverEvent(Type type,
const QPointF &scenePos,
const QPointF &globalPos,
const QPointF &oldPos,
1059 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
1060 : QSinglePointEvent(type, device, scenePos, scenePos, globalPos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
1064#if QT_DEPRECATED_SINCE(6
, 3
)
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078QHoverEvent::QHoverEvent(Type type,
const QPointF &pos,
const QPointF &oldPos,
1079 Qt::KeyboardModifiers modifiers,
const QPointingDevice *device)
1080 : QSinglePointEvent(type, device, pos, pos, pos, Qt::NoButton, Qt::NoButton, modifiers), m_oldPos(oldPos)
1087#if QT_CONFIG(wheelevent)
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
1118
1119
1122
1123
1124
1125
1126
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1149
1150
1151
1152
1153
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227QWheelEvent::QWheelEvent(
const QPointF &pos,
const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
1228 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
1229 bool inverted, Qt::MouseEventSource source,
const QPointingDevice *device)
1230 : QSinglePointEvent(Wheel, device, pos, pos, globalPos, Qt::NoButton, buttons, modifiers, source),
1231 m_pixelDelta(pixelDelta), m_angleDelta(angleDelta)
1234 m_invertedScrolling = inverted;
1237Q_IMPL_POINTER_EVENT(QWheelEvent)
1240
1241
1242bool QWheelEvent::isBeginEvent()
const
1244 return m_phase == Qt::ScrollBegin;
1248
1249
1250bool QWheelEvent::isUpdateEvent()
const
1252 return m_phase == Qt::ScrollUpdate || m_phase == Qt::ScrollMomentum;
1256
1257
1258bool QWheelEvent::isEndEvent()
const
1260 return m_phase == Qt::ScrollEnd;
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
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
1359
1360
1363
1364
1365
1366
1367
1368
1369
1372
1373
1374
1375
1376
1377
1378
1379
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
1408
1409
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425QKeyEvent::QKeyEvent(Type type,
int key, Qt::KeyboardModifiers modifiers,
const QString& text,
1426 bool autorep, quint16 count)
1427 : QInputEvent(type, QInputDevice::primaryKeyboard(), modifiers), m_text(text), m_key(key),
1428 m_scanCode(0), m_virtualKey(0), m_nativeModifiers(0),
1429 m_count(count), m_autoRepeat(autorep)
1431 if (type == QEvent::ShortcutOverride)
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453QKeyEvent::QKeyEvent(Type type,
int key, Qt::KeyboardModifiers modifiers,
1454 quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
1455 const QString &text,
bool autorep, quint16 count,
const QInputDevice *device)
1456 : QInputEvent(type, device, modifiers), m_text(text), m_key(key),
1457 m_scanCode(nativeScanCode), m_virtualKey(nativeVirtualKey), m_nativeModifiers(nativeModifiers),
1458 m_count(count), m_autoRepeat(autorep)
1460 if (type == QEvent::ShortcutOverride)
1468
1469
1470
1471
1472
1473
1474
1475
1476
1479
1480
1481
1482
1483
1484
1485
1486
1489
1490
1491
1492
1493
1494
1495
1496
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1534
1535
1536
1537
1538
1539
1540
1541
1542
1544Qt::KeyboardModifiers QKeyEvent::modifiers()
const
1546 if (key() == Qt::Key_Shift)
1547 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
1548 if (key() == Qt::Key_Control)
1549 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
1550 if (key() == Qt::Key_Alt)
1551 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
1552 if (key() == Qt::Key_Meta)
1553 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
1554 if (key() == Qt::Key_AltGr)
1555 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
1556 return QInputEvent::modifiers();
1560
1561
1562
1563
1564
1565
1566
1568#if QT_CONFIG(shortcut)
1570
1571
1572
1573
1574
1575
1576bool QKeyEvent::matches(QKeySequence::StandardKey matchKey)
const
1579 uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
1581 const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey);
1582 return bindings.contains(QKeySequence(searchkey));
1588
1589
1590
1591
1592
1593
1594
1595
1596
1599
1600
1601
1602
1603
1604
1605
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1630
1631
1632
1633
1634
1635
1636QFocusEvent::QFocusEvent(Type type, Qt::FocusReason reason)
1637 : QEvent(type), m_reason(reason)
1643
1644
1645Qt::FocusReason QFocusEvent::reason()
const
1651
1652
1653
1654
1655
1658
1659
1660
1661
1662
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
1693
1694
1697
1698
1699
1700QPaintEvent::QPaintEvent(
const QRegion& paintRegion)
1701 : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(
false)
1705
1706
1707
1708QPaintEvent::QPaintEvent(
const QRect &paintRect)
1709 : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(
false)
1716
1717
1718
1719
1720
1721
1724
1725
1726
1727
1728
1729
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1748
1749
1750
1751QMoveEvent::QMoveEvent(
const QPoint &pos,
const QPoint &oldPos)
1752 : QEvent(Move), m_pos(pos), m_oldPos(oldPos)
1758
1759
1760
1761
1762
1765
1766
1767
1768
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1793
1794
1795
1796QExposeEvent::QExposeEvent(
const QRegion &exposeRegion)
1798 , m_region(exposeRegion)
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1832
1833
1834
1835
1838
1839
1840QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType)
1841 : QEvent(PlatformSurface)
1842 , m_surfaceEventType(surfaceEventType)
1849
1850
1851
1852
1853
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1870
1871
1872
1873QResizeEvent::QResizeEvent(
const QSize &size,
const QSize &oldSize)
1874 : QEvent(Resize), m_size(size), m_oldSize(oldSize)
1880
1881
1882
1883
1884
1887
1888
1889
1890
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
1936
1937
1940
1941
1942
1943
1944QCloseEvent::QCloseEvent()
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1968
1969
1970
1971
1972
1973QIconDragEvent::QIconDragEvent()
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
2044
2045
2047#ifndef QT_NO_CONTEXTMENU
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos,
const QPoint &globalPos,
2060 Qt::KeyboardModifiers modifiers)
2061 : QInputEvent(ContextMenu, QPointingDevice::primaryPointingDevice(), modifiers), m_pos(pos), m_globalPos(globalPos), m_reason(reason)
2066#if QT_DEPRECATED_SINCE(6
, 4
)
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos)
2084 : QInputEvent(ContextMenu, QInputDevice::primaryKeyboard()), m_pos(pos), m_reason(reason)
2087 m_globalPos = QCursor::pos();
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2105
2106
2107
2108
2109
2110
2111
2114
2115
2116
2117
2118
2119
2120
2123
2124
2125
2126
2127
2128
2129
2132
2133
2134
2135
2136
2137
2138
2141
2142
2143
2144
2145
2146
2147
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2168
2169
2170
2171
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
2281
2282
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
2338
2339
2340
2341
2344
2345
2346
2347
2348
2349
2352
2353
2354
2355
2356
2357
2358
2359
2362
2363
2364
2365
2366
2367
2368QInputMethodEvent::QInputMethodEvent()
2369 : QEvent(QEvent::InputMethod), m_replacementStart(0), m_replacementLength(0)
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383QInputMethodEvent::QInputMethodEvent(
const QString &preeditText,
const QList<Attribute> &attributes)
2384 : QEvent(QEvent::InputMethod), m_preedit(preeditText), m_attributes(attributes),
2385 m_replacementStart(0), m_replacementLength(0)
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407void QInputMethodEvent::setCommitString(
const QString &commitString,
int replaceFrom,
int replaceLength)
2409 m_commit = commitString;
2410 m_replacementStart = replaceFrom;
2411 m_replacementLength = replaceLength;
2415
2416
2417
2418
2419
2420
2421
2422
2423
2426
2427
2428
2429
2430
2431
2432
2435
2436
2437
2438
2439
2440
2441
2442
2443
2446
2447
2448
2449
2450
2451
2452
2455
2456
2457
2458
2459
2460
2461
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2482
2483
2484
2485
2488
2489
2490QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries)
2491 : QEvent(InputMethodQuery),
2499
2500
2501void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query,
const QVariant &value)
2503 for (
int i = 0; i < m_values.size(); ++i) {
2504 if (m_values.at(i).query == query) {
2505 m_values[i].value = value;
2509 QueryPair pair = { query, value };
2510 m_values.append(pair);
2514
2515
2516QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query)
const
2518 for (
int i = 0; i < m_values.size(); ++i)
2519 if (m_values.at(i).query == query)
2520 return m_values.at(i).value;
2524#if QT_CONFIG(tabletevent)
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
2591
2592
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
2632QTabletEvent::QTabletEvent(Type type,
const QPointingDevice *dev,
const QPointF &pos,
const QPointF &globalPos,
2633 qreal pressure,
float xTilt,
float yTilt,
2634 float tangentialPressure, qreal rotation,
float z,
2635 Qt::KeyboardModifiers keyState,
2636 Qt::MouseButton button, Qt::MouseButtons buttons)
2637 : QSinglePointEvent(type, dev, pos, pos, globalPos, button, buttons, keyState),
2638 m_tangential(tangentialPressure),
2643 QEventPoint &p = point(0);
2644 QMutableEventPoint::setPressure(p, pressure);
2645 QMutableEventPoint::setRotation(p, rotation);
2648Q_IMPL_POINTER_EVENT(QTabletEvent)
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2665
2666
2667
2668
2669
2670
2671
2672
2673
2676
2677
2678
2679
2680
2681
2682
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2727
2728
2729
2730
2731
2732
2733
2734
2737
2738
2739
2740
2741
2742
2743
2744
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2772
2773
2774
2775
2776
2777
2778
2779
2782
2783
2784
2785
2786
2787
2788
2789
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2842#ifndef QT_NO_GESTURES
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
2905
2906
2908#if QT_DEPRECATED_SINCE(6
, 2
)
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
2927 const QPointF &localPos,
const QPointF &scenePos,
2928 const QPointF &globalPos, qreal realValue, quint64 sequenceId,
2930 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2931 Qt::NoButton, Qt::NoModifier),
2932 m_sequenceId(sequenceId), m_realValue(realValue), m_gestureType(type)
2934 if (qIsNull(realValue) && intValue != 0)
2935 m_realValue = intValue;
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
int fingerCount,
2963 const QPointF &localPos,
const QPointF &scenePos,
2964 const QPointF &globalPos, qreal value,
const QPointF &delta,
2966 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2967 Qt::NoButton, Qt::NoModifier),
2968 m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
2970 Q_ASSERT(fingerCount < 16);
2976
2977
2978
2979
2980
2983
2984
2985
2986
2987
2988
2989
2992
2993
2994
2995
2996
2997
2998
2999
3000
3003
3004
3005
3006
3007
3008
3009
3010
3011
3014
3015
3016
3017
3018
3019
3022
3023
3024
3025
3026
3027
3028
3031
3032
3033
3034
3035
3036
3037
3040
3041
3042
3043
3044
3045
3048
3049
3050
3051
3052
3053
3054
3057#if QT_CONFIG(draganddrop)
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070QDragMoveEvent::QDragMoveEvent(
const QPoint& pos, Qt::DropActions actions,
const QMimeData *data,
3071 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3072 : QDropEvent(pos, actions, data, buttons, modifiers, type)
3073 , m_rect(pos, QSize(1, 1))
3076Q_IMPL_EVENT_COMMON(QDragMoveEvent)
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3092
3093
3094
3095
3096
3097
3100
3101
3102
3103
3104
3105
3108
3109
3110
3111
3112
3113
3116
3117
3118
3119
3120
3121
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3160
3161
3162
3163
3164
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178QDropEvent::QDropEvent(
const QPointF& pos, Qt::DropActions actions,
const QMimeData *data,
3179 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3180 : QEvent(type), m_pos(pos), m_mouseState(buttons),
3181 m_modState(modifiers), m_actions(actions),
3184 m_defaultAction = m_dropAction =
3185 QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(m_actions, modifiers);
3189Q_IMPL_EVENT_COMMON(QDropEvent)
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203QObject* QDropEvent::source()
const
3205 if (
const QDragManager *manager = QDragManager::self())
3206 return manager->source();
3211void QDropEvent::setDropAction(Qt::DropAction action)
3213 if (!(action & m_actions) && action != Qt::IgnoreAction)
3214 action = m_defaultAction;
3215 m_dropAction = action;
3219
3220
3221
3222
3223
3226
3227
3228
3229
3230
3233
3234
3235
3236
3237
3240
3241
3242
3243
3244
3247
3248
3249
3250
3251
3254
3255
3256
3257
3258
3261
3262
3263
3264
3265
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3284
3285
3286
3287
3288
3289
3290
3291
3294
3295
3296
3297
3298
3299
3302
3303
3304
3305
3306
3307
3310
3311
3312
3313
3314
3315
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350QDragEnterEvent::QDragEnterEvent(
const QPoint& point, Qt::DropActions actions,
const QMimeData *data,
3351 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3352 : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
3355Q_IMPL_EVENT_COMMON(QDragEnterEvent)
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3400
3401
3402
3403
3404
3405QDragLeaveEvent::QDragLeaveEvent()
3409Q_IMPL_EVENT_COMMON(QDragLeaveEvent)
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3430
3431
3432
3433
3434
3435
3436
3437
3438QHelpEvent::QHelpEvent(Type type,
const QPoint &pos,
const QPoint &globalPos)
3439 : QEvent(type), m_pos(pos), m_globalPos(globalPos)
3443
3444
3445
3446
3447
3448
3451
3452
3453
3454
3455
3456
3459
3460
3461
3462
3463
3464
3467
3468
3469
3470
3471
3472
3475
3476
3477
3478
3479
3480
3481
3484
3485
3486
3487
3488
3489
3490
3494#ifndef QT_NO_STATUSTIP
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3539
3540
3541
3542
3543QStatusTipEvent::QStatusTipEvent(
const QString &tip)
3544 : QEvent(StatusTip), m_tip(tip)
3550
3551
3552
3553
3554
3555
3559#if QT_CONFIG(whatsthis)
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3574
3575
3576
3577
3578
3579QWhatsThisClickedEvent::QWhatsThisClickedEvent(
const QString &href)
3580 : QEvent(WhatsThisClicked), m_href(href)
3583Q_IMPL_EVENT_COMMON(QWhatsThisClickedEvent)
3586
3587
3588
3589
3590
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3614
3615
3616
3617
3618
3619
3620
3621QActionEvent::QActionEvent(
int type, QAction *action, QAction *before)
3622 : QEvent(
static_cast<QEvent::Type>(type)), m_action(action), m_before(before)
3625Q_IMPL_EVENT_COMMON(QActionEvent)
3628
3629
3630
3631
3632
3633
3636
3637
3638
3639
3640
3641
3642
3643
3644
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3669
3670
3671QHideEvent::QHideEvent()
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3695
3696
3697QShowEvent::QShowEvent()
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3744
3745
3746
3747
3748QFileOpenEvent::QFileOpenEvent(
const QString &file)
3749 : QEvent(FileOpen), m_file(file), m_url(QUrl::fromLocalFile(file))
3754
3755
3756
3757
3758QFileOpenEvent::QFileOpenEvent(
const QUrl &url)
3759 : QEvent(FileOpen), m_file(url.toLocalFile()), m_url(url)
3766
3767
3768
3769
3770
3771
3774
3775
3776
3777
3778
3779
3781#if QT_DEPRECATED_SINCE(6
, 6
)
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags)
const
3796 file.setFileName(m_file);
3797 return file.open(flags);
3801#ifndef QT_NO_TOOLBAR
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3818
3819
3820
3821
3822QToolBarChangeEvent::QToolBarChangeEvent(
bool t)
3823 : QEvent(ToolBarChange), m_toggle(t)
3829
3830
3831
3834
3835
3836
3837
3838
3839
3840
3841
3845#if QT_CONFIG(shortcut)
3848
3849
3850
3851
3852
3853
3854
3855
3856QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
int id,
bool ambiguous)
3857 : QEvent(Shortcut), m_sequence(key), m_shortcutId(id), m_ambiguous(ambiguous)
3862
3863
3864
3865
3866
3867
3868
3869QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
const QShortcut *shortcut,
bool ambiguous)
3870 : QEvent(Shortcut), m_sequence(key), m_shortcutId(0), m_ambiguous(ambiguous)
3873 auto priv =
static_cast<
const QShortcutPrivate *>(QShortcutPrivate::get(shortcut));
3874 auto index = priv->sc_sequences.indexOf(key);
3876 qWarning() <<
"Given QShortcut does not contain key-sequence " << key;
3879 m_shortcutId = priv->sc_ids[index];
3883Q_IMPL_EVENT_COMMON(QShortcutEvent)
3887#ifndef QT_NO_DEBUG_STREAM
3891 d <<
"QTouchEvent(";
3892 QtDebugUtils::formatQEnum(d, t.type());
3893 d <<
" device: " << t.device()->name();
3895 QtDebugUtils::formatQFlags(d, t.touchPointStates());
3896 d <<
", " << t.points().size() <<
" points: " << t.points() <<
')';
3901 d <<
'"' << Qt::hex;
3902 for (
int i = 0; i < s.size(); ++i) {
3905 d <<
"U+" << s.at(i).unicode();
3907 d << Qt::dec <<
'"';
3912 dbg <<
"[type= " << attr.type <<
", start=" << attr.start <<
", length=" << attr.length
3913 <<
", value=" << attr.value <<
']';
3919 d <<
"QInputMethodEvent(";
3920 if (!e->preeditString().isEmpty()) {
3922 formatUnicodeString(d, e->preeditString());
3924 if (!e->commitString().isEmpty()) {
3926 formatUnicodeString(d, e->commitString());
3928 if (e->replacementLength()) {
3929 d <<
", replacementStart=" << e->replacementStart() <<
", replacementLength="
3930 << e->replacementLength();
3932 const auto attributes = e->attributes();
3933 auto it = attributes.cbegin();
3934 const auto end = attributes.cend();
3936 d <<
", attributes= {";
3939 for (; it != end; ++it)
3948 QDebugStateSaver saver(d);
3950 const Qt::InputMethodQueries queries = e->queries();
3951 d <<
"QInputMethodQueryEvent(queries=" << Qt::showbase << Qt::hex <<
int(queries)
3952 << Qt::noshowbase << Qt::dec <<
", {";
3953 for (
unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
3954 if (queries & mask) {
3955 const Qt::InputMethodQuery query =
static_cast<Qt::InputMethodQuery>(mask);
3956 const QVariant value = e->value(query);
3957 if (value.isValid()) {
3959 QtDebugUtils::formatQEnum(d, query);
3961 if (query == Qt::ImHints)
3962 QtDebugUtils::formatQFlags(d, Qt::InputMethodHints(value.toInt()));
3964 d << value.toString();
3975 case QEvent::ActionAdded:
3976 case QEvent::ActionRemoved:
3977 case QEvent::ActionChanged:
3978 return "QActionEvent";
3979 case QEvent::MouseButtonPress:
3980 case QEvent::MouseButtonRelease:
3981 case QEvent::MouseButtonDblClick:
3982 case QEvent::MouseMove:
3983 case QEvent::NonClientAreaMouseMove:
3984 case QEvent::NonClientAreaMouseButtonPress:
3985 case QEvent::NonClientAreaMouseButtonRelease:
3986 case QEvent::NonClientAreaMouseButtonDblClick:
3987 return "QMouseEvent";
3988 case QEvent::DragEnter:
3989 return "QDragEnterEvent";
3990 case QEvent::DragMove:
3991 return "QDragMoveEvent";
3993 return "QDropEvent";
3994 case QEvent::KeyPress:
3995 case QEvent::KeyRelease:
3996 case QEvent::ShortcutOverride:
3998 case QEvent::FocusIn:
3999 case QEvent::FocusOut:
4000 case QEvent::FocusAboutToChange:
4001 return "QFocusEvent";
4002 case QEvent::ChildAdded:
4003 case QEvent::ChildPolished:
4004 case QEvent::ChildRemoved:
4005 return "QChildEvent";
4007 return "QPaintEvent";
4009 return "QMoveEvent";
4010 case QEvent::Resize:
4011 return "QResizeEvent";
4013 return "QShowEvent";
4015 return "QHideEvent";
4017 return "QEnterEvent";
4019 return "QCloseEvent";
4020 case QEvent::FileOpen:
4021 return "QFileOpenEvent";
4022#ifndef QT_NO_GESTURES
4023 case QEvent::NativeGesture:
4024 return "QNativeGestureEvent";
4025 case QEvent::Gesture:
4026 case QEvent::GestureOverride:
4027 return "QGestureEvent";
4029 case QEvent::HoverEnter:
4030 case QEvent::HoverLeave:
4031 case QEvent::HoverMove:
4032 return "QHoverEvent";
4033 case QEvent::TabletEnterProximity:
4034 case QEvent::TabletLeaveProximity:
4035 case QEvent::TabletPress:
4036 case QEvent::TabletMove:
4037 case QEvent::TabletRelease:
4038 return "QTabletEvent";
4039 case QEvent::StatusTip:
4040 return "QStatusTipEvent";
4041 case QEvent::ToolTip:
4042 return "QHelpEvent";
4043 case QEvent::WindowStateChange:
4044 return "QWindowStateChangeEvent";
4046 return "QWheelEvent";
4047 case QEvent::TouchBegin:
4048 case QEvent::TouchUpdate:
4049 case QEvent::TouchEnd:
4050 return "QTouchEvent";
4051 case QEvent::Shortcut:
4052 return "QShortcutEvent";
4053 case QEvent::InputMethod:
4054 return "QInputMethodEvent";
4055 case QEvent::InputMethodQuery:
4056 return "QInputMethodQueryEvent";
4057 case QEvent::OrientationChange:
4058 return "QScreenOrientationChangeEvent";
4059 case QEvent::ScrollPrepare:
4060 return "QScrollPrepareEvent";
4061 case QEvent::Scroll:
4062 return "QScrollEvent";
4063 case QEvent::GraphicsSceneMouseMove:
4064 case QEvent::GraphicsSceneMousePress:
4065 case QEvent::GraphicsSceneMouseRelease:
4066 case QEvent::GraphicsSceneMouseDoubleClick:
4067 return "QGraphicsSceneMouseEvent";
4068 case QEvent::GraphicsSceneContextMenu:
4069 case QEvent::GraphicsSceneHoverEnter:
4070 case QEvent::GraphicsSceneHoverMove:
4071 case QEvent::GraphicsSceneHoverLeave:
4072 case QEvent::GraphicsSceneHelp:
4073 case QEvent::GraphicsSceneDragEnter:
4074 case QEvent::GraphicsSceneDragMove:
4075 case QEvent::GraphicsSceneDragLeave:
4076 case QEvent::GraphicsSceneDrop:
4077 case QEvent::GraphicsSceneWheel:
4078 return "QGraphicsSceneEvent";
4080 return "QTimerEvent";
4081 case QEvent::PlatformSurface:
4082 return "QPlatformSurfaceEvent";
4089# if QT_CONFIG(draganddrop)
4091static void formatDropEvent(QDebug d,
const QDropEvent *e)
4093 const QEvent::Type type = e->type();
4094 d << eventClassName(type) <<
"(dropAction=";
4095 QtDebugUtils::formatQEnum(d, e->dropAction());
4096 d <<
", proposedAction=";
4097 QtDebugUtils::formatQEnum(d, e->proposedAction());
4098 d <<
", possibleActions=";
4099 QtDebugUtils::formatQFlags(d, e->possibleActions());
4101 QtDebugUtils::formatQPoint(d, e->position());
4102 if (type == QEvent::DragMove || type == QEvent::DragEnter)
4103 d <<
", answerRect=" <<
static_cast<
const QDragMoveEvent *>(e)->answerRect();
4104 d <<
", formats=" << e->mimeData()->formats();
4105 QtDebugUtils::formatNonNullQFlags(d,
", keyboardModifiers=", e->modifiers());
4107 QtDebugUtils::formatQFlags(d, e->buttons());
4112# if QT_CONFIG(tabletevent)
4114static void formatTabletEvent(QDebug d,
const QTabletEvent *e)
4116 const QEvent::Type type = e->type();
4118 d << eventClassName(type) <<
'(';
4119 QtDebugUtils::formatQEnum(d, type);
4121 QtDebugUtils::formatQFlags(d, e->buttons());
4123 QtDebugUtils::formatQPoint(d, e->position());
4124 d <<
" z=" << e->z()
4125 <<
" xTilt=" << e->xTilt()
4126 <<
" yTilt=" << e->yTilt();
4127 if (type == QEvent::TabletPress || type == QEvent::TabletMove)
4128 d <<
" pressure=" << e->pressure();
4129 if (e->device()->hasCapability(QInputDevice::Capability::Rotation))
4130 d <<
" rotation=" << e->rotation();
4131 if (e->deviceType() == QInputDevice::DeviceType::Airbrush)
4132 d <<
" tangentialPressure=" << e->tangentialPressure();
4133 d <<
" dev=" << e->device() <<
')';
4141 return dbg <<
"QEventPoint(0x0)";
4143 return operator<<(dbg, *tp);
4148 QDebugStateSaver saver(dbg);
4150 dbg <<
"QEventPoint(id=" << tp.id() <<
" ts=" << tp.timestamp();
4152 QtDebugUtils::formatQPoint(dbg, tp.position());
4154 QtDebugUtils::formatQPoint(dbg, tp.scenePosition());
4156 QtDebugUtils::formatQPoint(dbg, tp.globalPosition());
4158 QtDebugUtils::formatQEnum(dbg, tp.state());
4159 if (!qFuzzyIsNull(tp.pressure()) && !qFuzzyCompare(tp.pressure(), 1))
4160 dbg <<
" pressure=" << tp.pressure();
4161 if (!tp.ellipseDiameters().isEmpty() || !qFuzzyIsNull(tp.rotation())) {
4163 << tp.ellipseDiameters().width() <<
"x" << tp.ellipseDiameters().height()
4164 <<
" \u2221 " << tp.rotation() <<
')';
4167 QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF());
4169 QtDebugUtils::formatQPoint(dbg, tp.pressPosition());
4171 QtDebugUtils::formatQPoint(dbg, tp.lastPosition());
4173 QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPosition());
4180 QDebugStateSaver saver(dbg);
4183 return dbg <<
"QEvent(0x0)";
4186 const QEvent::Type type = e->type();
4187 bool isMouse =
false;
4189 case QEvent::Expose:
4190 dbg <<
"QExposeEvent()";
4193 dbg <<
"QPaintEvent(" <<
static_cast<
const QPaintEvent *>(e)->region() <<
')';
4195 case QEvent::MouseButtonPress:
4196 case QEvent::MouseMove:
4197 case QEvent::MouseButtonRelease:
4198 case QEvent::MouseButtonDblClick:
4199 case QEvent::NonClientAreaMouseButtonPress:
4200 case QEvent::NonClientAreaMouseMove:
4201 case QEvent::NonClientAreaMouseButtonRelease:
4202 case QEvent::NonClientAreaMouseButtonDblClick:
4205 case QEvent::HoverEnter:
4206 case QEvent::HoverMove:
4207 case QEvent::HoverLeave:
4209 const QSinglePointEvent *spe =
static_cast<
const QSinglePointEvent*>(e);
4210 const Qt::MouseButton button = spe->button();
4211 const Qt::MouseButtons buttons = spe->buttons();
4212 dbg << eventClassName(type) <<
'(';
4213 QtDebugUtils::formatQEnum(dbg, type);
4214 dbg <<
" ts=" << spe->timestamp();
4216 if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
4218 QtDebugUtils::formatQEnum(dbg, button);
4220 if (buttons && button != buttons) {
4222 QtDebugUtils::formatQFlags(dbg, buttons);
4225 QtDebugUtils::formatNonNullQFlags(dbg,
", ", spe->modifiers());
4227 QtDebugUtils::formatQPoint(dbg, spe->position());
4229 QtDebugUtils::formatQPoint(dbg, spe->scenePosition());
4231 QtDebugUtils::formatQPoint(dbg, spe->globalPosition());
4232 dbg <<
" dev=" << spe->device() <<
')';
4234 auto src =
static_cast<
const QMouseEvent*>(e)->source();
4235 if (src != Qt::MouseEventNotSynthesized) {
4237 QtDebugUtils::formatQEnum(dbg, src);
4242# if QT_CONFIG(wheelevent)
4243 case QEvent::Wheel: {
4244 const QWheelEvent *we =
static_cast<
const QWheelEvent *>(e);
4245 dbg <<
"QWheelEvent(" << we->phase();
4246 if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
4247 dbg <<
", pixelDelta=" << we->pixelDelta() <<
", angleDelta=" << we->angleDelta();
4248 dbg <<
" dev=" << we->device() <<
')';
4253 case QEvent::KeyPress:
4254 case QEvent::KeyRelease:
4255 case QEvent::ShortcutOverride:
4257 const QKeyEvent *ke =
static_cast<
const QKeyEvent *>(e);
4258 dbg <<
"QKeyEvent(";
4259 QtDebugUtils::formatQEnum(dbg, type);
4261 QtDebugUtils::formatQEnum(dbg,
static_cast<Qt::Key>(ke->key()));
4262 QtDebugUtils::formatNonNullQFlags(dbg,
", ", ke->modifiers());
4263 if (!ke->text().isEmpty())
4264 dbg <<
", text=" << ke->text();
4265 if (ke->isAutoRepeat())
4266 dbg <<
", autorepeat, count=" << ke->count();
4267 if (dbg.verbosity() > QDebug::DefaultVerbosity) {
4268 dbg <<
", nativeScanCode=" << ke->nativeScanCode();
4269 dbg <<
", nativeVirtualKey=" << ke->nativeVirtualKey();
4274#if QT_CONFIG(shortcut)
4275 case QEvent::Shortcut: {
4276 const QShortcutEvent *se =
static_cast<
const QShortcutEvent *>(e);
4277 dbg <<
"QShortcutEvent(" << se->key().toString() <<
", id=" << se->shortcutId();
4278 if (se->isAmbiguous())
4279 dbg <<
", ambiguous";
4284 case QEvent::FocusAboutToChange:
4285 case QEvent::FocusIn:
4286 case QEvent::FocusOut:
4287 dbg <<
"QFocusEvent(";
4288 QtDebugUtils::formatQEnum(dbg, type);
4290 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QFocusEvent *>(e)->reason());
4293 case QEvent::Move: {
4294 const QMoveEvent *me =
static_cast<
const QMoveEvent *>(e);
4295 dbg <<
"QMoveEvent(";
4296 QtDebugUtils::formatQPoint(dbg, me->pos());
4297 if (!me->spontaneous())
4298 dbg <<
", non-spontaneous";
4302 case QEvent::Resize: {
4303 const QResizeEvent *re =
static_cast<
const QResizeEvent *>(e);
4304 dbg <<
"QResizeEvent(";
4305 QtDebugUtils::formatQSize(dbg, re->size());
4306 if (!re->spontaneous())
4307 dbg <<
", non-spontaneous";
4311# if QT_CONFIG(draganddrop)
4312 case QEvent::DragEnter:
4313 case QEvent::DragMove:
4315 formatDropEvent(dbg,
static_cast<
const QDropEvent *>(e));
4318 case QEvent::InputMethod:
4319 formatInputMethodEvent(dbg,
static_cast<
const QInputMethodEvent *>(e));
4321 case QEvent::InputMethodQuery:
4322 formatInputMethodQueryEvent(dbg,
static_cast<
const QInputMethodQueryEvent *>(e));
4324 case QEvent::TouchBegin:
4325 case QEvent::TouchUpdate:
4326 case QEvent::TouchEnd:
4327 formatTouchEvent(dbg, *
static_cast<
const QTouchEvent*>(e));
4329 case QEvent::ChildAdded:
4330 case QEvent::ChildPolished:
4331 case QEvent::ChildRemoved:
4332 dbg <<
"QChildEvent(";
4333 QtDebugUtils::formatQEnum(dbg, type);
4334 dbg <<
", " << (
static_cast<
const QChildEvent*>(e))->child() <<
')';
4336# ifndef QT_NO_GESTURES
4337 case QEvent::NativeGesture: {
4338 const QNativeGestureEvent *ne =
static_cast<
const QNativeGestureEvent *>(e);
4339 dbg <<
"QNativeGestureEvent(";
4340 QtDebugUtils::formatQEnum(dbg, ne->gestureType());
4341 dbg <<
", fingerCount=" << ne->fingerCount() <<
", localPos=";
4342 QtDebugUtils::formatQPoint(dbg, ne->position());
4343 if (!qIsNull(ne->value()))
4344 dbg <<
", value=" << ne->value();
4345 if (!ne->delta().isNull()) {
4347 QtDebugUtils::formatQPoint(dbg, ne->delta());
4353 case QEvent::ApplicationStateChange:
4354 dbg <<
"QApplicationStateChangeEvent(";
4355 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QApplicationStateChangeEvent *>(e)->applicationState());
4358# ifndef QT_NO_CONTEXTMENU
4359 case QEvent::ContextMenu:
4360 dbg <<
"QContextMenuEvent(" <<
static_cast<
const QContextMenuEvent *>(e)->pos() <<
')';
4363# if QT_CONFIG(tabletevent)
4364 case QEvent::TabletEnterProximity:
4365 case QEvent::TabletLeaveProximity:
4366 case QEvent::TabletPress:
4367 case QEvent::TabletMove:
4368 case QEvent::TabletRelease:
4369 formatTabletEvent(dbg,
static_cast<
const QTabletEvent *>(e));
4373 dbg <<
"QEnterEvent(" <<
static_cast<
const QEnterEvent *>(e)->position() <<
')';
4376 dbg <<
"QTimerEvent(id=" <<
static_cast<
const QTimerEvent *>(e)->timerId() <<
')';
4378 case QEvent::PlatformSurface:
4379 dbg <<
"QPlatformSurfaceEvent(surfaceEventType=";
4380 switch (
static_cast<
const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {
4381 case QPlatformSurfaceEvent::SurfaceCreated:
4382 dbg <<
"SurfaceCreated";
4384 case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
4385 dbg <<
"SurfaceAboutToBeDestroyed";
4390 case QEvent::ScrollPrepare: {
4391 const QScrollPrepareEvent *se =
static_cast<
const QScrollPrepareEvent *>(e);
4392 dbg <<
"QScrollPrepareEvent(viewportSize=" << se->viewportSize()
4393 <<
", contentPosRange=" << se->contentPosRange()
4394 <<
", contentPos=" << se->contentPos() <<
')';
4397 case QEvent::Scroll: {
4398 const QScrollEvent *se =
static_cast<
const QScrollEvent *>(e);
4399 dbg <<
"QScrollEvent(contentPos=" << se->contentPos()
4400 <<
", overshootDistance=" << se->overshootDistance()
4401 <<
", scrollState=" << se->scrollState() <<
')';
4405 dbg << eventClassName(type) <<
'(';
4406 QtDebugUtils::formatQEnum(dbg, type);
4407 dbg <<
", " << (
const void *)e <<
')';
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4429
4430
4431
4432
4435
4436
4437
4438
4439
4440
4441
4442
4443
4446
4447
4448
4449
4450
4451
4452
4455
4456
4457
4458
4459
4460
4461
4464
4465
4466
4469
4470QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates oldState,
bool isOverride)
4471 : QEvent(WindowStateChange), m_oldStates(oldState), m_override(isOverride)
4476
4477bool QWindowStateChangeEvent::isOverride()
const
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
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
4617
4618
4619
4621QTouchEvent::QTouchEvent(QEvent::Type eventType,
4622 const QPointingDevice *device,
4623 Qt::KeyboardModifiers modifiers,
4624 const QList<QEventPoint> &touchPoints)
4625 : QPointerEvent(eventType, device, modifiers, touchPoints),
4628 for (QEventPoint &point : m_points) {
4629 m_touchPointStates |= point.state();
4630 QMutableEventPoint::setDevice(point, device);
4634#if QT_DEPRECATED_SINCE(6
, 0
)
4636
4637
4638
4639
4640
4641
4642QTouchEvent::QTouchEvent(QEvent::Type eventType,
4643 const QPointingDevice *device,
4644 Qt::KeyboardModifiers modifiers,
4645 QEventPoint::States touchPointStates,
4646 const QList<QEventPoint> &touchPoints)
4647 : QPointerEvent(eventType, device, modifiers, touchPoints),
4649 m_touchPointStates(touchPointStates)
4651 for (QEventPoint &point : m_points)
4652 QMutableEventPoint::setDevice(point, device);
4659
4660
4661bool QTouchEvent::isBeginEvent()
const
4663 return m_touchPointStates.testFlag(QEventPoint::State::Pressed);
4667
4668
4669
4670bool QTouchEvent::isUpdateEvent()
const
4672 return !m_touchPointStates.testFlag(QEventPoint::State::Pressed) &&
4673 !m_touchPointStates.testFlag(QEventPoint::State::Released);
4677
4678
4679bool QTouchEvent::isEndEvent()
const
4681 return m_touchPointStates.testFlag(QEventPoint::State::Released);
4685
4686
4687
4688
4691
4692
4693
4696
4697
4698
4699
4700
4701
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4722
4723
4724
4725QScrollPrepareEvent::QScrollPrepareEvent(
const QPointF &startPos)
4726 : QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
4733
4734
4735
4736
4739
4740
4741
4742
4743
4746
4747
4748
4751
4752
4753
4756
4757
4758
4759
4760void QScrollPrepareEvent::setViewportSize(
const QSizeF &size)
4762 m_viewportSize = size;
4766
4767
4768
4769
4770void QScrollPrepareEvent::setContentPosRange(
const QRectF &rect)
4772 m_contentPosRange = rect;
4776
4777
4778
4779
4780void QScrollPrepareEvent::setContentPos(
const QPointF &pos)
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4818
4819
4820
4821
4822
4823QScrollEvent::QScrollEvent(
const QPointF &contentPos,
const QPointF &overshootDistance, ScrollState scrollState)
4824 : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)
4831
4832
4833
4834
4837
4838
4839
4840
4841
4842
4843
4846
4847
4848
4849
4850
4851
4852
4853
4854
4857
4858
4859
4860QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation)
4861 : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)
4868
4869
4870
4871
4874
4875
4876
4877
4880
4881
4882
4883QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState applicationState)
4884 : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState)
4891
4892
4893
4894
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4916
4917
4918
4919
4920
4921
4922
4923QChildWindowEvent::QChildWindowEvent(Type type, QWindow *childWindow)
4924 : QEvent(type), c(childWindow)
4931
4932
4933
4934
4936QMutableTouchEvent::~QMutableTouchEvent()
4940
4941
4942void QMutableTouchEvent::addPoint(QTouchEvent *e,
const QEventPoint &point)
4944 e->m_points.append(point);
4945 auto &added = e->m_points.last();
4946 if (!added.device())
4947 QMutableEventPoint::setDevice(added, e->pointingDevice());
4948 e->m_touchPointStates |= point.state();
4952QMutableSinglePointEvent::~QMutableSinglePointEvent()
4956
4957
4958void QMutableTouchEvent::addPoint(
const QEventPoint &point)
4960 addPoint(
this, point);
4965#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)