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
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
1197
1198
1199
1200QWheelEvent::QWheelEvent(
const QPointF &pos,
const QPointF &globalPos, QPoint pixelDelta, QPoint angleDelta,
1201 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
1202 bool inverted, Qt::MouseEventSource source,
const QPointingDevice *device)
1203 : QSinglePointEvent(Wheel, device, pos, pos, globalPos, Qt::NoButton, buttons, modifiers, source),
1204 m_pixelDelta(pixelDelta), m_angleDelta(angleDelta)
1207 m_invertedScrolling = inverted;
1210Q_IMPL_POINTER_EVENT(QWheelEvent)
1213
1214
1215bool QWheelEvent::isBeginEvent()
const
1217 return m_phase == Qt::ScrollBegin;
1221
1222
1223bool QWheelEvent::isUpdateEvent()
const
1225 return m_phase == Qt::ScrollUpdate || m_phase == Qt::ScrollMomentum;
1229
1230
1231bool QWheelEvent::isEndEvent()
const
1233 return m_phase == Qt::ScrollEnd;
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1297
1298
1299
1300
1301
1302
1303
1304
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350QKeyEvent::QKeyEvent(Type type,
int key, Qt::KeyboardModifiers modifiers,
const QString& text,
1351 bool autorep, quint16 count)
1352 : QInputEvent(type, QInputDevice::primaryKeyboard(), modifiers), m_text(text), m_key(key),
1353 m_scanCode(0), m_virtualKey(0), m_nativeModifiers(0),
1354 m_count(count), m_autoRepeat(autorep)
1356 if (type == QEvent::ShortcutOverride)
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378QKeyEvent::QKeyEvent(Type type,
int key, Qt::KeyboardModifiers modifiers,
1379 quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers,
1380 const QString &text,
bool autorep, quint16 count,
const QInputDevice *device)
1381 : QInputEvent(type, device, modifiers), m_text(text), m_key(key),
1382 m_scanCode(nativeScanCode), m_virtualKey(nativeVirtualKey), m_nativeModifiers(nativeModifiers),
1383 m_count(count), m_autoRepeat(autorep)
1385 if (type == QEvent::ShortcutOverride)
1393
1394
1395
1396
1397
1398
1399
1400
1401
1404
1405
1406
1407
1408
1409
1410
1411
1414
1415
1416
1417
1418
1419
1420
1421
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1459
1460
1461
1462
1463
1464
1465
1466
1467
1469Qt::KeyboardModifiers QKeyEvent::modifiers()
const
1471 if (key() == Qt::Key_Shift)
1472 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ShiftModifier);
1473 if (key() == Qt::Key_Control)
1474 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::ControlModifier);
1475 if (key() == Qt::Key_Alt)
1476 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
1477 if (key() == Qt::Key_Meta)
1478 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
1479 if (key() == Qt::Key_AltGr)
1480 return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
1481 return QInputEvent::modifiers();
1485
1486
1487
1488
1489
1490
1491
1493#if QT_CONFIG(shortcut)
1495
1496
1497
1498
1499
1500
1501bool QKeyEvent::matches(QKeySequence::StandardKey matchKey)
const
1504 uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
1506 const QList<QKeySequence> bindings = QKeySequence::keyBindings(matchKey);
1507 return bindings.contains(QKeySequence(searchkey));
1513
1514
1515
1516
1517
1518
1519
1520
1521
1524
1525
1526
1527
1528
1529
1530
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1555
1556
1557
1558
1559
1560
1561QFocusEvent::QFocusEvent(Type type, Qt::FocusReason reason)
1562 : QEvent(type), m_reason(reason)
1568
1569
1570Qt::FocusReason QFocusEvent::reason()
const
1576
1577
1578
1579
1580
1583
1584
1585
1586
1587
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1622
1623
1624
1625QPaintEvent::QPaintEvent(
const QRegion& paintRegion)
1626 : QEvent(Paint), m_rect(paintRegion.boundingRect()), m_region(paintRegion), m_erased(
false)
1630
1631
1632
1633QPaintEvent::QPaintEvent(
const QRect &paintRect)
1634 : QEvent(Paint), m_rect(paintRect),m_region(paintRect), m_erased(
false)
1641
1642
1643
1644
1645
1646
1649
1650
1651
1652
1653
1654
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1673
1674
1675
1676QMoveEvent::QMoveEvent(
const QPoint &pos,
const QPoint &oldPos)
1677 : QEvent(Move), m_pos(pos), m_oldPos(oldPos)
1683
1684
1685
1686
1687
1690
1691
1692
1693
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1718
1719
1720
1721QExposeEvent::QExposeEvent(
const QRegion &exposeRegion)
1723 , m_region(exposeRegion)
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1757
1758
1759
1760
1763
1764
1765QPlatformSurfaceEvent::QPlatformSurfaceEvent(SurfaceEventType surfaceEventType)
1766 : QEvent(PlatformSurface)
1767 , m_surfaceEventType(surfaceEventType)
1774
1775
1776
1777
1778
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1795
1796
1797
1798QResizeEvent::QResizeEvent(
const QSize &size,
const QSize &oldSize)
1799 : QEvent(Resize), m_size(size), m_oldSize(oldSize)
1805
1806
1807
1808
1809
1812
1813
1814
1815
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1865
1866
1867
1868
1869QCloseEvent::QCloseEvent()
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1893
1894
1895
1896
1897
1898QIconDragEvent::QIconDragEvent()
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
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1972#ifndef QT_NO_CONTEXTMENU
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos,
const QPoint &globalPos,
1985 Qt::KeyboardModifiers modifiers)
1986 : QInputEvent(ContextMenu, QPointingDevice::primaryPointingDevice(), modifiers), m_pos(pos), m_globalPos(globalPos), m_reason(reason)
1991#if QT_DEPRECATED_SINCE(6
, 4
)
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008QContextMenuEvent::QContextMenuEvent(Reason reason,
const QPoint &pos)
2009 : QInputEvent(ContextMenu, QInputDevice::primaryKeyboard()), m_pos(pos), m_reason(reason)
2012 m_globalPos = QCursor::pos();
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2030
2031
2032
2033
2034
2035
2036
2039
2040
2041
2042
2043
2044
2045
2048
2049
2050
2051
2052
2053
2054
2057
2058
2059
2060
2061
2062
2063
2066
2067
2068
2069
2070
2071
2072
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2093
2094
2095
2096
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
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
2263
2264
2265
2266
2269
2270
2271
2272
2273
2274
2277
2278
2279
2280
2281
2282
2283
2284
2287
2288
2289
2290
2291
2292
2293QInputMethodEvent::QInputMethodEvent()
2294 : QEvent(QEvent::InputMethod), m_replacementStart(0), m_replacementLength(0)
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308QInputMethodEvent::QInputMethodEvent(
const QString &preeditText,
const QList<Attribute> &attributes)
2309 : QEvent(QEvent::InputMethod), m_preedit(preeditText), m_attributes(attributes),
2310 m_replacementStart(0), m_replacementLength(0)
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332void QInputMethodEvent::setCommitString(
const QString &commitString,
int replaceFrom,
int replaceLength)
2334 m_commit = commitString;
2335 m_replacementStart = replaceFrom;
2336 m_replacementLength = replaceLength;
2340
2341
2342
2343
2344
2345
2346
2347
2348
2351
2352
2353
2354
2355
2356
2357
2360
2361
2362
2363
2364
2365
2366
2367
2368
2371
2372
2373
2374
2375
2376
2377
2380
2381
2382
2383
2384
2385
2386
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2407
2408
2409
2410
2413
2414
2415QInputMethodQueryEvent::QInputMethodQueryEvent(Qt::InputMethodQueries queries)
2416 : QEvent(InputMethodQuery),
2424
2425
2426void QInputMethodQueryEvent::setValue(Qt::InputMethodQuery query,
const QVariant &value)
2428 for (
int i = 0; i < m_values.size(); ++i) {
2429 if (m_values.at(i).query == query) {
2430 m_values[i].value = value;
2434 QueryPair pair = { query, value };
2435 m_values.append(pair);
2439
2440
2441QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query)
const
2443 for (
int i = 0; i < m_values.size(); ++i)
2444 if (m_values.at(i).query == query)
2445 return m_values.at(i).value;
2449#if QT_CONFIG(tabletevent)
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557QTabletEvent::QTabletEvent(Type type,
const QPointingDevice *dev,
const QPointF &pos,
const QPointF &globalPos,
2558 qreal pressure,
float xTilt,
float yTilt,
2559 float tangentialPressure, qreal rotation,
float z,
2560 Qt::KeyboardModifiers keyState,
2561 Qt::MouseButton button, Qt::MouseButtons buttons)
2562 : QSinglePointEvent(type, dev, pos, pos, globalPos, button, buttons, keyState),
2563 m_tangential(tangentialPressure),
2568 QEventPoint &p = point(0);
2569 QMutableEventPoint::setPressure(p, pressure);
2570 QMutableEventPoint::setRotation(p, rotation);
2573Q_IMPL_POINTER_EVENT(QTabletEvent)
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2590
2591
2592
2593
2594
2595
2596
2597
2598
2601
2602
2603
2604
2605
2606
2607
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2652
2653
2654
2655
2656
2657
2658
2659
2662
2663
2664
2665
2666
2667
2668
2669
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2697
2698
2699
2700
2701
2702
2703
2704
2707
2708
2709
2710
2711
2712
2713
2714
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2767#ifndef QT_NO_GESTURES
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2833#if QT_DEPRECATED_SINCE(6
, 2
)
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
2852 const QPointF &localPos,
const QPointF &scenePos,
2853 const QPointF &globalPos, qreal realValue, quint64 sequenceId,
2855 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2856 Qt::NoButton, Qt::NoModifier),
2857 m_sequenceId(sequenceId), m_realValue(realValue), m_gestureType(type)
2859 if (qIsNull(realValue) && intValue != 0)
2860 m_realValue = intValue;
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type,
const QPointingDevice *device,
int fingerCount,
2888 const QPointF &localPos,
const QPointF &scenePos,
2889 const QPointF &globalPos, qreal value,
const QPointF &delta,
2891 : QSinglePointEvent(QEvent::NativeGesture, device, localPos, scenePos, globalPos, Qt::NoButton,
2892 Qt::NoButton, Qt::NoModifier),
2893 m_sequenceId(sequenceId), m_delta(delta), m_realValue(value), m_gestureType(type), m_fingerCount(fingerCount)
2895 Q_ASSERT(fingerCount < 16);
2901
2902
2903
2904
2905
2908
2909
2910
2911
2912
2913
2914
2917
2918
2919
2920
2921
2922
2923
2924
2925
2928
2929
2930
2931
2932
2933
2934
2935
2936
2939
2940
2941
2942
2943
2944
2947
2948
2949
2950
2951
2952
2953
2956
2957
2958
2959
2960
2961
2962
2965
2966
2967
2968
2969
2970
2973
2974
2975
2976
2977
2978
2979
2982#if QT_CONFIG(draganddrop)
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995QDragMoveEvent::QDragMoveEvent(
const QPoint& pos, Qt::DropActions actions,
const QMimeData *data,
2996 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
2997 : QDropEvent(pos, actions, data, buttons, modifiers, type)
2998 , m_rect(pos, QSize(1, 1))
3001Q_IMPL_EVENT_COMMON(QDragMoveEvent)
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3017
3018
3019
3020
3021
3022
3025
3026
3027
3028
3029
3030
3033
3034
3035
3036
3037
3038
3041
3042
3043
3044
3045
3046
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3085
3086
3087
3088
3089
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103QDropEvent::QDropEvent(
const QPointF& pos, Qt::DropActions actions,
const QMimeData *data,
3104 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type)
3105 : QEvent(type), m_pos(pos), m_mouseState(buttons),
3106 m_modState(modifiers), m_actions(actions),
3109 m_defaultAction = m_dropAction =
3110 QGuiApplicationPrivate::platformIntegration()->drag()->defaultAction(m_actions, modifiers);
3114Q_IMPL_EVENT_COMMON(QDropEvent)
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128QObject* QDropEvent::source()
const
3130 if (
const QDragManager *manager = QDragManager::self())
3131 return manager->source();
3136void QDropEvent::setDropAction(Qt::DropAction action)
3138 if (!(action & m_actions) && action != Qt::IgnoreAction)
3139 action = m_defaultAction;
3140 m_dropAction = action;
3144
3145
3146
3147
3148
3151
3152
3153
3154
3155
3158
3159
3160
3161
3162
3165
3166
3167
3168
3169
3172
3173
3174
3175
3176
3179
3180
3181
3182
3183
3186
3187
3188
3189
3190
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3209
3210
3211
3212
3213
3214
3215
3216
3219
3220
3221
3222
3223
3224
3227
3228
3229
3230
3231
3232
3235
3236
3237
3238
3239
3240
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275QDragEnterEvent::QDragEnterEvent(
const QPoint& point, Qt::DropActions actions,
const QMimeData *data,
3276 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
3277 : QDragMoveEvent(point, actions, data, buttons, modifiers, DragEnter)
3280Q_IMPL_EVENT_COMMON(QDragEnterEvent)
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3325
3326
3327
3328
3329
3330QDragLeaveEvent::QDragLeaveEvent()
3334Q_IMPL_EVENT_COMMON(QDragLeaveEvent)
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3355
3356
3357
3358
3359
3360
3361
3362
3363QHelpEvent::QHelpEvent(Type type,
const QPoint &pos,
const QPoint &globalPos)
3364 : QEvent(type), m_pos(pos), m_globalPos(globalPos)
3368
3369
3370
3371
3372
3373
3376
3377
3378
3379
3380
3381
3384
3385
3386
3387
3388
3389
3392
3393
3394
3395
3396
3397
3400
3401
3402
3403
3404
3405
3406
3409
3410
3411
3412
3413
3414
3415
3419#ifndef QT_NO_STATUSTIP
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3464
3465
3466
3467
3468QStatusTipEvent::QStatusTipEvent(
const QString &tip)
3469 : QEvent(StatusTip), m_tip(tip)
3475
3476
3477
3478
3479
3480
3484#if QT_CONFIG(whatsthis)
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3499
3500
3501
3502
3503
3504QWhatsThisClickedEvent::QWhatsThisClickedEvent(
const QString &href)
3505 : QEvent(WhatsThisClicked), m_href(href)
3508Q_IMPL_EVENT_COMMON(QWhatsThisClickedEvent)
3511
3512
3513
3514
3515
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3539
3540
3541
3542
3543
3544
3545
3546QActionEvent::QActionEvent(
int type, QAction *action, QAction *before)
3547 : QEvent(
static_cast<QEvent::Type>(type)), m_action(action), m_before(before)
3550Q_IMPL_EVENT_COMMON(QActionEvent)
3553
3554
3555
3556
3557
3558
3561
3562
3563
3564
3565
3566
3567
3568
3569
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3594
3595
3596QHideEvent::QHideEvent()
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3620
3621
3622QShowEvent::QShowEvent()
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3669
3670
3671
3672
3673QFileOpenEvent::QFileOpenEvent(
const QString &file)
3674 : QEvent(FileOpen), m_file(file), m_url(QUrl::fromLocalFile(file))
3679
3680
3681
3682
3683QFileOpenEvent::QFileOpenEvent(
const QUrl &url)
3684 : QEvent(FileOpen), m_file(url.toLocalFile()), m_url(url)
3691
3692
3693
3694
3695
3696
3699
3700
3701
3702
3703
3704
3706#if QT_DEPRECATED_SINCE(6
, 6
)
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags)
const
3721 file.setFileName(m_file);
3722 return file.open(flags);
3726#ifndef QT_NO_TOOLBAR
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3743
3744
3745
3746
3747QToolBarChangeEvent::QToolBarChangeEvent(
bool t)
3748 : QEvent(ToolBarChange), m_toggle(t)
3754
3755
3756
3759
3760
3761
3762
3763
3764
3765
3766
3770#if QT_CONFIG(shortcut)
3773
3774
3775
3776
3777
3778
3779
3780
3781QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
int id,
bool ambiguous)
3782 : QEvent(Shortcut), m_sequence(key), m_shortcutId(id), m_ambiguous(ambiguous)
3787
3788
3789
3790
3791
3792
3793
3794QShortcutEvent::QShortcutEvent(
const QKeySequence &key,
const QShortcut *shortcut,
bool ambiguous)
3795 : QEvent(Shortcut), m_sequence(key), m_shortcutId(0), m_ambiguous(ambiguous)
3798 auto priv =
static_cast<
const QShortcutPrivate *>(QShortcutPrivate::get(shortcut));
3799 auto index = priv->sc_sequences.indexOf(key);
3801 qWarning() <<
"Given QShortcut does not contain key-sequence " << key;
3804 m_shortcutId = priv->sc_ids[index];
3808Q_IMPL_EVENT_COMMON(QShortcutEvent)
3812#ifndef QT_NO_DEBUG_STREAM
3816 d <<
"QTouchEvent(";
3817 QtDebugUtils::formatQEnum(d, t.type());
3818 d <<
" device: " << t.device()->name();
3820 QtDebugUtils::formatQFlags(d, t.touchPointStates());
3821 d <<
", " << t.points().size() <<
" points: " << t.points() <<
')';
3826 d <<
'"' << Qt::hex;
3827 for (
int i = 0; i < s.size(); ++i) {
3830 d <<
"U+" << s.at(i).unicode();
3832 d << Qt::dec <<
'"';
3837 dbg <<
"[type= " << attr.type <<
", start=" << attr.start <<
", length=" << attr.length
3838 <<
", value=" << attr.value <<
']';
3844 d <<
"QInputMethodEvent(";
3845 if (!e->preeditString().isEmpty()) {
3847 formatUnicodeString(d, e->preeditString());
3849 if (!e->commitString().isEmpty()) {
3851 formatUnicodeString(d, e->commitString());
3853 if (e->replacementLength()) {
3854 d <<
", replacementStart=" << e->replacementStart() <<
", replacementLength="
3855 << e->replacementLength();
3857 const auto attributes = e->attributes();
3858 auto it = attributes.cbegin();
3859 const auto end = attributes.cend();
3861 d <<
", attributes= {";
3864 for (; it != end; ++it)
3873 QDebugStateSaver saver(d);
3875 const Qt::InputMethodQueries queries = e->queries();
3876 d <<
"QInputMethodQueryEvent(queries=" << Qt::showbase << Qt::hex <<
int(queries)
3877 << Qt::noshowbase << Qt::dec <<
", {";
3878 for (
unsigned mask = 1; mask <= Qt::ImInputItemClipRectangle; mask<<=1) {
3879 if (queries & mask) {
3880 const Qt::InputMethodQuery query =
static_cast<Qt::InputMethodQuery>(mask);
3881 const QVariant value = e->value(query);
3882 if (value.isValid()) {
3884 QtDebugUtils::formatQEnum(d, query);
3886 if (query == Qt::ImHints)
3887 QtDebugUtils::formatQFlags(d, Qt::InputMethodHints(value.toInt()));
3889 d << value.toString();
3900 case QEvent::ActionAdded:
3901 case QEvent::ActionRemoved:
3902 case QEvent::ActionChanged:
3903 return "QActionEvent";
3904 case QEvent::MouseButtonPress:
3905 case QEvent::MouseButtonRelease:
3906 case QEvent::MouseButtonDblClick:
3907 case QEvent::MouseMove:
3908 case QEvent::NonClientAreaMouseMove:
3909 case QEvent::NonClientAreaMouseButtonPress:
3910 case QEvent::NonClientAreaMouseButtonRelease:
3911 case QEvent::NonClientAreaMouseButtonDblClick:
3912 return "QMouseEvent";
3913 case QEvent::DragEnter:
3914 return "QDragEnterEvent";
3915 case QEvent::DragMove:
3916 return "QDragMoveEvent";
3918 return "QDropEvent";
3919 case QEvent::KeyPress:
3920 case QEvent::KeyRelease:
3921 case QEvent::ShortcutOverride:
3923 case QEvent::FocusIn:
3924 case QEvent::FocusOut:
3925 case QEvent::FocusAboutToChange:
3926 return "QFocusEvent";
3927 case QEvent::ChildAdded:
3928 case QEvent::ChildPolished:
3929 case QEvent::ChildRemoved:
3930 return "QChildEvent";
3932 return "QPaintEvent";
3934 return "QMoveEvent";
3935 case QEvent::Resize:
3936 return "QResizeEvent";
3938 return "QShowEvent";
3940 return "QHideEvent";
3942 return "QEnterEvent";
3944 return "QCloseEvent";
3945 case QEvent::FileOpen:
3946 return "QFileOpenEvent";
3947#ifndef QT_NO_GESTURES
3948 case QEvent::NativeGesture:
3949 return "QNativeGestureEvent";
3950 case QEvent::Gesture:
3951 case QEvent::GestureOverride:
3952 return "QGestureEvent";
3954 case QEvent::HoverEnter:
3955 case QEvent::HoverLeave:
3956 case QEvent::HoverMove:
3957 return "QHoverEvent";
3958 case QEvent::TabletEnterProximity:
3959 case QEvent::TabletLeaveProximity:
3960 case QEvent::TabletPress:
3961 case QEvent::TabletMove:
3962 case QEvent::TabletRelease:
3963 return "QTabletEvent";
3964 case QEvent::StatusTip:
3965 return "QStatusTipEvent";
3966 case QEvent::ToolTip:
3967 return "QHelpEvent";
3968 case QEvent::WindowStateChange:
3969 return "QWindowStateChangeEvent";
3971 return "QWheelEvent";
3972 case QEvent::TouchBegin:
3973 case QEvent::TouchUpdate:
3974 case QEvent::TouchEnd:
3975 return "QTouchEvent";
3976 case QEvent::Shortcut:
3977 return "QShortcutEvent";
3978 case QEvent::InputMethod:
3979 return "QInputMethodEvent";
3980 case QEvent::InputMethodQuery:
3981 return "QInputMethodQueryEvent";
3982 case QEvent::OrientationChange:
3983 return "QScreenOrientationChangeEvent";
3984 case QEvent::ScrollPrepare:
3985 return "QScrollPrepareEvent";
3986 case QEvent::Scroll:
3987 return "QScrollEvent";
3988 case QEvent::GraphicsSceneMouseMove:
3989 case QEvent::GraphicsSceneMousePress:
3990 case QEvent::GraphicsSceneMouseRelease:
3991 case QEvent::GraphicsSceneMouseDoubleClick:
3992 return "QGraphicsSceneMouseEvent";
3993 case QEvent::GraphicsSceneContextMenu:
3994 case QEvent::GraphicsSceneHoverEnter:
3995 case QEvent::GraphicsSceneHoverMove:
3996 case QEvent::GraphicsSceneHoverLeave:
3997 case QEvent::GraphicsSceneHelp:
3998 case QEvent::GraphicsSceneDragEnter:
3999 case QEvent::GraphicsSceneDragMove:
4000 case QEvent::GraphicsSceneDragLeave:
4001 case QEvent::GraphicsSceneDrop:
4002 case QEvent::GraphicsSceneWheel:
4003 return "QGraphicsSceneEvent";
4005 return "QTimerEvent";
4006 case QEvent::PlatformSurface:
4007 return "QPlatformSurfaceEvent";
4014# if QT_CONFIG(draganddrop)
4016static void formatDropEvent(QDebug d,
const QDropEvent *e)
4018 const QEvent::Type type = e->type();
4019 d << eventClassName(type) <<
"(dropAction=";
4020 QtDebugUtils::formatQEnum(d, e->dropAction());
4021 d <<
", proposedAction=";
4022 QtDebugUtils::formatQEnum(d, e->proposedAction());
4023 d <<
", possibleActions=";
4024 QtDebugUtils::formatQFlags(d, e->possibleActions());
4026 QtDebugUtils::formatQPoint(d, e->position());
4027 if (type == QEvent::DragMove || type == QEvent::DragEnter)
4028 d <<
", answerRect=" <<
static_cast<
const QDragMoveEvent *>(e)->answerRect();
4029 d <<
", formats=" << e->mimeData()->formats();
4030 QtDebugUtils::formatNonNullQFlags(d,
", keyboardModifiers=", e->modifiers());
4032 QtDebugUtils::formatQFlags(d, e->buttons());
4037# if QT_CONFIG(tabletevent)
4039static void formatTabletEvent(QDebug d,
const QTabletEvent *e)
4041 const QEvent::Type type = e->type();
4043 d << eventClassName(type) <<
'(';
4044 QtDebugUtils::formatQEnum(d, type);
4046 QtDebugUtils::formatQFlags(d, e->buttons());
4048 QtDebugUtils::formatQPoint(d, e->position());
4049 d <<
" z=" << e->z()
4050 <<
" xTilt=" << e->xTilt()
4051 <<
" yTilt=" << e->yTilt();
4052 if (type == QEvent::TabletPress || type == QEvent::TabletMove)
4053 d <<
" pressure=" << e->pressure();
4054 if (e->device()->hasCapability(QInputDevice::Capability::Rotation))
4055 d <<
" rotation=" << e->rotation();
4056 if (e->deviceType() == QInputDevice::DeviceType::Airbrush)
4057 d <<
" tangentialPressure=" << e->tangentialPressure();
4058 d <<
" dev=" << e->device() <<
')';
4066 return dbg <<
"QEventPoint(0x0)";
4068 return operator<<(dbg, *tp);
4073 QDebugStateSaver saver(dbg);
4075 dbg <<
"QEventPoint(id=" << tp.id() <<
" ts=" << tp.timestamp();
4077 QtDebugUtils::formatQPoint(dbg, tp.position());
4079 QtDebugUtils::formatQPoint(dbg, tp.scenePosition());
4081 QtDebugUtils::formatQPoint(dbg, tp.globalPosition());
4083 QtDebugUtils::formatQEnum(dbg, tp.state());
4084 if (!qFuzzyIsNull(tp.pressure()) && !qFuzzyCompare(tp.pressure(), 1))
4085 dbg <<
" pressure=" << tp.pressure();
4086 if (!tp.ellipseDiameters().isEmpty() || !qFuzzyIsNull(tp.rotation())) {
4088 << tp.ellipseDiameters().width() <<
"x" << tp.ellipseDiameters().height()
4089 <<
" \u2221 " << tp.rotation() <<
')';
4092 QtDebugUtils::formatQPoint(dbg, tp.velocity().toPointF());
4094 QtDebugUtils::formatQPoint(dbg, tp.pressPosition());
4096 QtDebugUtils::formatQPoint(dbg, tp.lastPosition());
4098 QtDebugUtils::formatQPoint(dbg, tp.position() - tp.lastPosition());
4105 QDebugStateSaver saver(dbg);
4108 return dbg <<
"QEvent(0x0)";
4111 const QEvent::Type type = e->type();
4112 bool isMouse =
false;
4114 case QEvent::Expose:
4115 dbg <<
"QExposeEvent()";
4118 dbg <<
"QPaintEvent(" <<
static_cast<
const QPaintEvent *>(e)->region() <<
')';
4120 case QEvent::MouseButtonPress:
4121 case QEvent::MouseMove:
4122 case QEvent::MouseButtonRelease:
4123 case QEvent::MouseButtonDblClick:
4124 case QEvent::NonClientAreaMouseButtonPress:
4125 case QEvent::NonClientAreaMouseMove:
4126 case QEvent::NonClientAreaMouseButtonRelease:
4127 case QEvent::NonClientAreaMouseButtonDblClick:
4130 case QEvent::HoverEnter:
4131 case QEvent::HoverMove:
4132 case QEvent::HoverLeave:
4134 const QSinglePointEvent *spe =
static_cast<
const QSinglePointEvent*>(e);
4135 const Qt::MouseButton button = spe->button();
4136 const Qt::MouseButtons buttons = spe->buttons();
4137 dbg << eventClassName(type) <<
'(';
4138 QtDebugUtils::formatQEnum(dbg, type);
4139 dbg <<
" ts=" << spe->timestamp();
4141 if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) {
4143 QtDebugUtils::formatQEnum(dbg, button);
4145 if (buttons && button != buttons) {
4147 QtDebugUtils::formatQFlags(dbg, buttons);
4150 QtDebugUtils::formatNonNullQFlags(dbg,
", ", spe->modifiers());
4152 QtDebugUtils::formatQPoint(dbg, spe->position());
4154 QtDebugUtils::formatQPoint(dbg, spe->scenePosition());
4156 QtDebugUtils::formatQPoint(dbg, spe->globalPosition());
4157 dbg <<
" dev=" << spe->device() <<
')';
4159 auto src =
static_cast<
const QMouseEvent*>(e)->source();
4160 if (src != Qt::MouseEventNotSynthesized) {
4162 QtDebugUtils::formatQEnum(dbg, src);
4167# if QT_CONFIG(wheelevent)
4168 case QEvent::Wheel: {
4169 const QWheelEvent *we =
static_cast<
const QWheelEvent *>(e);
4170 dbg <<
"QWheelEvent(" << we->phase();
4171 if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
4172 dbg <<
", pixelDelta=" << we->pixelDelta() <<
", angleDelta=" << we->angleDelta();
4173 dbg <<
" dev=" << we->device() <<
')';
4178 case QEvent::KeyPress:
4179 case QEvent::KeyRelease:
4180 case QEvent::ShortcutOverride:
4182 const QKeyEvent *ke =
static_cast<
const QKeyEvent *>(e);
4183 dbg <<
"QKeyEvent(";
4184 QtDebugUtils::formatQEnum(dbg, type);
4186 QtDebugUtils::formatQEnum(dbg,
static_cast<Qt::Key>(ke->key()));
4187 QtDebugUtils::formatNonNullQFlags(dbg,
", ", ke->modifiers());
4188 if (!ke->text().isEmpty())
4189 dbg <<
", text=" << ke->text();
4190 if (ke->isAutoRepeat())
4191 dbg <<
", autorepeat, count=" << ke->count();
4192 if (dbg.verbosity() > QDebug::DefaultVerbosity) {
4193 dbg <<
", nativeScanCode=" << ke->nativeScanCode();
4194 dbg <<
", nativeVirtualKey=" << ke->nativeVirtualKey();
4199#if QT_CONFIG(shortcut)
4200 case QEvent::Shortcut: {
4201 const QShortcutEvent *se =
static_cast<
const QShortcutEvent *>(e);
4202 dbg <<
"QShortcutEvent(" << se->key().toString() <<
", id=" << se->shortcutId();
4203 if (se->isAmbiguous())
4204 dbg <<
", ambiguous";
4209 case QEvent::FocusAboutToChange:
4210 case QEvent::FocusIn:
4211 case QEvent::FocusOut:
4212 dbg <<
"QFocusEvent(";
4213 QtDebugUtils::formatQEnum(dbg, type);
4215 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QFocusEvent *>(e)->reason());
4218 case QEvent::Move: {
4219 const QMoveEvent *me =
static_cast<
const QMoveEvent *>(e);
4220 dbg <<
"QMoveEvent(";
4221 QtDebugUtils::formatQPoint(dbg, me->pos());
4222 if (!me->spontaneous())
4223 dbg <<
", non-spontaneous";
4227 case QEvent::Resize: {
4228 const QResizeEvent *re =
static_cast<
const QResizeEvent *>(e);
4229 dbg <<
"QResizeEvent(";
4230 QtDebugUtils::formatQSize(dbg, re->size());
4231 if (!re->spontaneous())
4232 dbg <<
", non-spontaneous";
4236# if QT_CONFIG(draganddrop)
4237 case QEvent::DragEnter:
4238 case QEvent::DragMove:
4240 formatDropEvent(dbg,
static_cast<
const QDropEvent *>(e));
4243 case QEvent::InputMethod:
4244 formatInputMethodEvent(dbg,
static_cast<
const QInputMethodEvent *>(e));
4246 case QEvent::InputMethodQuery:
4247 formatInputMethodQueryEvent(dbg,
static_cast<
const QInputMethodQueryEvent *>(e));
4249 case QEvent::TouchBegin:
4250 case QEvent::TouchUpdate:
4251 case QEvent::TouchEnd:
4252 formatTouchEvent(dbg, *
static_cast<
const QTouchEvent*>(e));
4254 case QEvent::ChildAdded:
4255 case QEvent::ChildPolished:
4256 case QEvent::ChildRemoved:
4257 dbg <<
"QChildEvent(";
4258 QtDebugUtils::formatQEnum(dbg, type);
4259 dbg <<
", " << (
static_cast<
const QChildEvent*>(e))->child() <<
')';
4261# ifndef QT_NO_GESTURES
4262 case QEvent::NativeGesture: {
4263 const QNativeGestureEvent *ne =
static_cast<
const QNativeGestureEvent *>(e);
4264 dbg <<
"QNativeGestureEvent(";
4265 QtDebugUtils::formatQEnum(dbg, ne->gestureType());
4266 dbg <<
", fingerCount=" << ne->fingerCount() <<
", localPos=";
4267 QtDebugUtils::formatQPoint(dbg, ne->position());
4268 if (!qIsNull(ne->value()))
4269 dbg <<
", value=" << ne->value();
4270 if (!ne->delta().isNull()) {
4272 QtDebugUtils::formatQPoint(dbg, ne->delta());
4278 case QEvent::ApplicationStateChange:
4279 dbg <<
"QApplicationStateChangeEvent(";
4280 QtDebugUtils::formatQEnum(dbg,
static_cast<
const QApplicationStateChangeEvent *>(e)->applicationState());
4283# ifndef QT_NO_CONTEXTMENU
4284 case QEvent::ContextMenu:
4285 dbg <<
"QContextMenuEvent(" <<
static_cast<
const QContextMenuEvent *>(e)->pos() <<
')';
4288# if QT_CONFIG(tabletevent)
4289 case QEvent::TabletEnterProximity:
4290 case QEvent::TabletLeaveProximity:
4291 case QEvent::TabletPress:
4292 case QEvent::TabletMove:
4293 case QEvent::TabletRelease:
4294 formatTabletEvent(dbg,
static_cast<
const QTabletEvent *>(e));
4298 dbg <<
"QEnterEvent(" <<
static_cast<
const QEnterEvent *>(e)->position() <<
')';
4301 dbg <<
"QTimerEvent(id=" <<
static_cast<
const QTimerEvent *>(e)->timerId() <<
')';
4303 case QEvent::PlatformSurface:
4304 dbg <<
"QPlatformSurfaceEvent(surfaceEventType=";
4305 switch (
static_cast<
const QPlatformSurfaceEvent *>(e)->surfaceEventType()) {
4306 case QPlatformSurfaceEvent::SurfaceCreated:
4307 dbg <<
"SurfaceCreated";
4309 case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed:
4310 dbg <<
"SurfaceAboutToBeDestroyed";
4315 case QEvent::ScrollPrepare: {
4316 const QScrollPrepareEvent *se =
static_cast<
const QScrollPrepareEvent *>(e);
4317 dbg <<
"QScrollPrepareEvent(viewportSize=" << se->viewportSize()
4318 <<
", contentPosRange=" << se->contentPosRange()
4319 <<
", contentPos=" << se->contentPos() <<
')';
4322 case QEvent::Scroll: {
4323 const QScrollEvent *se =
static_cast<
const QScrollEvent *>(e);
4324 dbg <<
"QScrollEvent(contentPos=" << se->contentPos()
4325 <<
", overshootDistance=" << se->overshootDistance()
4326 <<
", scrollState=" << se->scrollState() <<
')';
4330 dbg << eventClassName(type) <<
'(';
4331 QtDebugUtils::formatQEnum(dbg, type);
4332 dbg <<
", " << (
const void *)e <<
')';
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4354
4355
4356
4357
4360
4361
4362
4363
4364
4365
4366
4367
4368
4371
4372
4373
4374
4375
4376
4377
4380
4381
4382
4383
4384
4385
4386
4389
4390
4391
4394
4395QWindowStateChangeEvent::QWindowStateChangeEvent(Qt::WindowStates oldState,
bool isOverride)
4396 : QEvent(WindowStateChange), m_oldStates(oldState), m_override(isOverride)
4401
4402bool QWindowStateChangeEvent::isOverride()
const
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
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
4542
4543
4544
4546QTouchEvent::QTouchEvent(QEvent::Type eventType,
4547 const QPointingDevice *device,
4548 Qt::KeyboardModifiers modifiers,
4549 const QList<QEventPoint> &touchPoints)
4550 : QPointerEvent(eventType, device, modifiers, touchPoints),
4553 for (QEventPoint &point : m_points) {
4554 m_touchPointStates |= point.state();
4555 QMutableEventPoint::setDevice(point, device);
4559#if QT_DEPRECATED_SINCE(6
, 0
)
4561
4562
4563
4564
4565
4566
4567QTouchEvent::QTouchEvent(QEvent::Type eventType,
4568 const QPointingDevice *device,
4569 Qt::KeyboardModifiers modifiers,
4570 QEventPoint::States touchPointStates,
4571 const QList<QEventPoint> &touchPoints)
4572 : QPointerEvent(eventType, device, modifiers, touchPoints),
4574 m_touchPointStates(touchPointStates)
4576 for (QEventPoint &point : m_points)
4577 QMutableEventPoint::setDevice(point, device);
4584
4585
4586bool QTouchEvent::isBeginEvent()
const
4588 return m_touchPointStates.testFlag(QEventPoint::State::Pressed);
4592
4593
4594
4595bool QTouchEvent::isUpdateEvent()
const
4597 return !m_touchPointStates.testFlag(QEventPoint::State::Pressed) &&
4598 !m_touchPointStates.testFlag(QEventPoint::State::Released);
4602
4603
4604bool QTouchEvent::isEndEvent()
const
4606 return m_touchPointStates.testFlag(QEventPoint::State::Released);
4610
4611
4612
4613
4616
4617
4618
4621
4622
4623
4624
4625
4626
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4647
4648
4649
4650QScrollPrepareEvent::QScrollPrepareEvent(
const QPointF &startPos)
4651 : QEvent(QEvent::ScrollPrepare), m_startPos(startPos)
4658
4659
4660
4661
4664
4665
4666
4667
4668
4671
4672
4673
4676
4677
4678
4681
4682
4683
4684
4685void QScrollPrepareEvent::setViewportSize(
const QSizeF &size)
4687 m_viewportSize = size;
4691
4692
4693
4694
4695void QScrollPrepareEvent::setContentPosRange(
const QRectF &rect)
4697 m_contentPosRange = rect;
4701
4702
4703
4704
4705void QScrollPrepareEvent::setContentPos(
const QPointF &pos)
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4743
4744
4745
4746
4747
4748QScrollEvent::QScrollEvent(
const QPointF &contentPos,
const QPointF &overshootDistance, ScrollState scrollState)
4749 : QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)
4756
4757
4758
4759
4762
4763
4764
4765
4766
4767
4768
4771
4772
4773
4774
4775
4776
4777
4778
4779
4782
4783
4784
4785QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation)
4786 : QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)
4793
4794
4795
4796
4799
4800
4801
4802
4805
4806
4807
4808QApplicationStateChangeEvent::QApplicationStateChangeEvent(Qt::ApplicationState applicationState)
4809 : QEvent(QEvent::ApplicationStateChange), m_applicationState(applicationState)
4816
4817
4818
4819
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4841
4842
4843
4844
4845
4846
4847
4848QChildWindowEvent::QChildWindowEvent(Type type, QWindow *childWindow)
4849 : QEvent(type), c(childWindow)
4856
4857
4858
4859
4861QMutableTouchEvent::~QMutableTouchEvent()
4865
4866
4867void QMutableTouchEvent::addPoint(QTouchEvent *e,
const QEventPoint &point)
4869 e->m_points.append(point);
4870 auto &added = e->m_points.last();
4871 if (!added.device())
4872 QMutableEventPoint::setDevice(added, e->pointingDevice());
4873 e->m_touchPointStates |= point.state();
4877QMutableSinglePointEvent::~QMutableSinglePointEvent()
4881
4882
4883void QMutableTouchEvent::addPoint(
const QEventPoint &point)
4885 addPoint(
this, point);
4890#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.
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)