Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsysteminterface.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4#include <qpa/qplatformwindow.h>
6#include "private/qguiapplication_p.h"
7#include "private/qevent_p.h"
8#include "private/qeventpoint_p.h"
9#include "private/qpointingdevice_p.h"
10#include "private/qscreen_p.h"
11#include <QAbstractEventDispatcher>
12#include <qpa/qplatformintegration.h>
13#include <qdebug.h>
14#include "qhighdpiscaling_p.h"
15
16#include <QtCore/qscopedvaluerollback.h>
17#include <QtCore/private/qlocking_p.h>
18
19#if QT_CONFIG(draganddrop)
20#include <qpa/qplatformdrag.h>
21#endif
22
24
25using namespace Qt::StringLiterals;
26
27Q_LOGGING_CATEGORY(lcQpaInputDevices, "qt.qpa.input.devices")
28
29Q_CONSTINIT QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
30bool QWindowSystemInterfacePrivate::synchronousWindowSystemEvents = false;
31bool QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse = true;
33Q_CONSTINIT QMutex QWindowSystemInterfacePrivate::flushEventMutex;
34Q_CONSTINIT QAtomicInt QWindowSystemInterfacePrivate::eventAccepted;
36QWindowSystemInterfacePrivate::WindowSystemEventList QWindowSystemInterfacePrivate::windowSystemEventQueue;
37
39
40
41// ------------------- QWindowSystemInterfacePrivate -------------------
42
53template<typename Delivery>
55{
56 template<typename EventType, typename ...Args>
57 static bool handleEvent(Args ...);
58};
59
60/*
61 Handles a window system event.
62
63 By default this function posts the event on the window system event queue and
64 wakes the Gui event dispatcher. Qt Gui will then handle the event asynchronously
65 at a later point. The return value is not used in asynchronous mode and will
66 always be true.
67
68 In synchronous mode Qt Gui will process the event immediately. The return value
69 indicates if Qt accepted the event. If the event is delivered from another thread
70 than the Qt main thread the window system event queue is flushed, which may deliver
71 other events as well.
72
73 \sa flushWindowSystemEvents(), setSynchronousWindowSystemEvents()
74*/
75template<>
76template<typename EventType, typename ...Args>
83
84/*
85 Handles a window system event synchronously.
86
87 Qt Gui will process the event immediately. The return value indicates if Qt
88 accepted the event.
89
90 If the event is delivered from another thread than the Qt main thread the
91 window system event queue is flushed, which may deliver other events as
92 well.
93*/
94template<>
95template<typename EventType, typename ...Args>
97{
100 // Process the event immediately on the Gui thread and return the accepted state
103 return false;
104 } else {
106 }
107 return event.eventAccepted;
108 } else {
109 // Post the event on the Qt main thread queue and flush the queue.
110 // This will wake up the Gui thread which will process the event.
111 // Return the accepted state for the last event on the queue,
112 // which is the event posted by this function.
115 }
116}
117
118/*
119 Handles a window system event asynchronously by posting the event to Qt Gui.
120
121 This function posts the event on the window system event queue and wakes the
122 Gui event dispatcher. Qt Gui will then handle the event asynchronously at a
123 later point.
124*/
125template<>
126template<typename EventType, typename ...Args>
134
135template <typename EventType, typename Delivery = QWindowSystemInterface::DefaultDelivery, typename ...Args>
136static bool handleWindowSystemEvent(Args ...args)
137{
138 return QWindowSystemHelper<Delivery>::template handleEvent<EventType>(args...);
139}
140
142{
143 return windowSystemEventQueue.count();
144}
145
147{
148 return windowSystemEventQueue.nonUserInputEventsQueued();
149}
150
152{
153 return windowSystemEventQueue.takeFirstOrReturnNull();
154}
155
157{
158 return windowSystemEventQueue.takeFirstNonUserInputOrReturnNull();
159}
160
165
167{
168 windowSystemEventQueue.remove(event);
169}
170
172{
173 if (!eventHandler)
174 eventHandler = handler;
175}
176
178{
179 if (eventHandler == handler)
180 eventHandler = nullptr;
181}
182
187
193
194//------------------------------------------------------------
195//
196// Callback functions for plugins:
197//
198
199#define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName, ...) \
200 template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::DefaultDelivery>(__VA_ARGS__); \
201 template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::SynchronousDelivery>(__VA_ARGS__); \
202 template Q_GUI_EXPORT ReturnType QWindowSystemInterface::HandlerName<QWindowSystemInterface::AsynchronousDelivery>(__VA_ARGS__); \
203 template<typename Delivery> ReturnType QWindowSystemInterface::HandlerName(__VA_ARGS__)
204
217QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
218{
219 if (window) {
220 handleWindowSystemEvent<QWindowSystemInterfacePrivate::EnterEvent, Delivery>(window,
222 }
223}
224
226{
227 handleWindowSystemEvent<QWindowSystemInterfacePrivate::LeaveEvent, Delivery>(window);
228}
229
238{
239 handleLeaveEvent<AsynchronousDelivery>(leave);
240 handleEnterEvent(enter, local, global);
241}
242
244{
245 handleWindowSystemEvent<QWindowSystemInterfacePrivate::FocusWindowEvent, Delivery>(window, r);
246}
247
248QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowStateChanged, QWindow *window, Qt::WindowStates newState, int oldState)
249{
251 if (oldState < Qt::WindowNoState)
252 oldState = window->windowStates();
253
254 handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowStateChangedEvent, Delivery>(window, newState, Qt::WindowStates(oldState));
255}
256
257QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowScreenChanged, QWindow *window, QScreen *screen)
258{
259 handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowScreenChangedEvent, Delivery>(window, screen);
260}
261
262QT_DEFINE_QPA_EVENT_HANDLER(void, handleWindowDevicePixelRatioChanged, QWindow *window)
263{
264 handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent, Delivery>(window);
265}
266
267
268QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
269{
270 handleWindowSystemEvent<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent, Delivery>(window);
271}
272
273QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
274{
276 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent, Delivery>(newState, forcePropagate);
277}
278
279QT_DEFINE_QPA_EVENT_HANDLER(bool, handleApplicationTermination)
280{
281 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent, Delivery>(
283}
284
286 : WindowSystemEvent(GeometryChange)
287 , window(window)
288 , newGeometry(newGeometry)
289{
290 if (const QPlatformWindow *pw = window->handle()) {
291 const auto nativeGeometry = pw->QPlatformWindow::geometry();
293 }
294}
295
296QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const QRect &newRect)
297{
299 const auto newRectDi = QHighDpi::fromNativeWindowGeometry(newRect, window);
300 if (window->handle()) {
301 // Persist the new geometry so that QWindow::geometry() can be queried in the resize event
302 window->handle()->QPlatformWindow::setGeometry(newRect);
303 // FIXME: This does not work during platform window creation, where the QWindow does not
304 // have its handle set up yet. Platforms that deliver events during window creation need
305 // to handle the persistence manually, e.g. by overriding geometry().
306 }
307 handleWindowSystemEvent<QWindowSystemInterfacePrivate::GeometryChangeEvent, Delivery>(window, newRectDi);
308}
309
312 , window(window)
313 , isExposed(window && window->handle() ? window->handle()->isExposed() : false)
314 , region(region)
315{
316}
317
335QT_DEFINE_QPA_EVENT_HANDLER(bool, handleExposeEvent, QWindow *window, const QRegion &region)
336{
337 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::ExposeEvent, Delivery>(window,
339}
340
341QT_DEFINE_QPA_EVENT_HANDLER(bool, handlePaintEvent, QWindow *window, const QRegion &region)
342{
343 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::PaintEvent, Delivery>(window,
345}
346
347
349{
351 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::CloseEvent, Delivery>(window);
352}
353
361 const QPointF &local, const QPointF &global, Qt::MouseButtons state,
362 Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
364{
365 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
366 return handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
367}
368
370 const QPointF &local, const QPointF &global, Qt::MouseButtons state,
371 Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
373{
374 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
375 return handleMouseEvent<Delivery>(window, time, device, local, global, state, button, type, mods, source);
376}
377
378QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp,
379 const QPointF &local, const QPointF &global, Qt::MouseButtons state,
380 Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
382{
383 return handleMouseEvent<Delivery>(window, timestamp, QPointingDevice::primaryPointingDevice(),
384 local, global, state, button, type, mods, source);
385}
386
387QT_DEFINE_QPA_EVENT_HANDLER(bool, handleMouseEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
388 const QPointF &local, const QPointF &global, Qt::MouseButtons state,
389 Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
391{
392
393 bool isNonClientArea = {};
394
395 switch (type) {
398 Q_ASSERT_X(false, "QWindowSystemInterface::handleMouseEvent",
399 "QTBUG-71263: Native double clicks are not implemented.");
400 return false;
404 isNonClientArea = false;
405 break;
409 isNonClientArea = true;
410 break;
411 default:
412 Q_UNREACHABLE();
413 }
414
415 auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
417
418 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::MouseEvent, Delivery>(window,
419 timestamp, localPos, globalPos, state, mods, button, type, source, isNonClientArea, device);
420}
421
422bool QWindowSystemInterface::handleShortcutEvent(QWindow *window, ulong timestamp, int keyCode, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode,
423 quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text, bool autorepeat, ushort count)
424{
425#if QT_CONFIG(shortcut)
426 if (!window)
428
429 QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;
430 if (shortcutMap.state() == QKeySequence::NoMatch) {
431 // Check if the shortcut is overridden by some object in the event delivery path (typically the focus object).
432 // If so, we should not look up the shortcut in the shortcut map, but instead deliver the event as a regular
433 // key event, so that the target that accepted the shortcut override event can handle it. Note that we only
434 // do this if the shortcut map hasn't found a partial shortcut match yet. If it has, the shortcut can not be
435 // overridden.
436 bool overridden = handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, SynchronousDelivery>
437 (window,timestamp, QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,
438 nativeVirtualKey, nativeModifiers, text, autorepeat, count);
439 if (overridden)
440 return false;
441 }
442
443 // The shortcut event is dispatched as a QShortcutEvent, not a QKeyEvent, but we use
444 // the QKeyEvent as a container for the various properties that the shortcut map needs
445 // to inspect to determine if a shortcut matched the keys that were pressed.
446 QKeyEvent keyEvent(QEvent::ShortcutOverride, keyCode, modifiers, nativeScanCode,
447 nativeVirtualKey, nativeModifiers, text, autorepeat, count);
448
449 return shortcutMap.tryShortcut(&keyEvent);
450#else
452 Q_UNUSED(timestamp);
453 Q_UNUSED(keyCode);
455 Q_UNUSED(nativeScanCode);
456 Q_UNUSED(nativeVirtualKey);
457 Q_UNUSED(nativeModifiers);
458 Q_UNUSED(text);
459 Q_UNUSED(autorepeat);
461 return false;
462#endif
463}
464
465QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count) {
466 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
467 return handleKeyEvent<Delivery>(window, time, t, k, mods, text, autorep, count);
468}
469
470QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
471{
472 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent, Delivery>(window,
473 timestamp, t, k, mods, text, autorep, count);
474}
475
477 quint32 nativeScanCode, quint32 nativeVirtualKey,
478 quint32 nativeModifiers,
479 const QString& text, bool autorep,
481{
482 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
483 return handleExtendedKeyEvent(window, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers,
484 text, autorep, count);
485}
486
488 Qt::KeyboardModifiers modifiers,
489 quint32 nativeScanCode, quint32 nativeVirtualKey,
490 quint32 nativeModifiers,
491 const QString& text, bool autorep,
493{
494 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::KeyEvent>(window,
495 timestamp, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count);
496}
497
498bool QWindowSystemInterface::handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource source)
499{
500 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
501 return handleWheelEvent(window, time, local, global, pixelDelta, angleDelta, mods, phase, source);
502}
503
504bool QWindowSystemInterface::handleWheelEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
505 Qt::MouseEventSource source, bool invertedScrolling)
506{
507 return handleWheelEvent(window, timestamp, QPointingDevice::primaryPointingDevice(), local, global,
508 pixelDelta, angleDelta, mods, phase, source, invertedScrolling);
509}
510
512 const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta,
513 Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
514 Qt::MouseEventSource source, bool invertedScrolling)
515{
516 // Qt 4 sends two separate wheel events for horizontal and vertical
517 // deltas. For Qt 5 we want to send the deltas in one event, but at the
518 // same time preserve source and behavior compatibility with Qt 4.
519 //
520 // In addition high-resolution pixel-based deltas are also supported.
521 // Platforms that does not support these may pass a null point here.
522 // Angle deltas must always be sent in addition to pixel deltas.
523
524 // Pass Qt::ScrollBegin and Qt::ScrollEnd through
525 // even if the wheel delta is null.
526 if (angleDelta.isNull() && phase == Qt::ScrollUpdate)
527 return false;
528
529 // Simple case: vertical deltas only:
530 if (angleDelta.y() != 0 && angleDelta.x() == 0) {
531 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
533 pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling, device);
534 }
535
536 // Simple case: horizontal deltas only:
537 if (angleDelta.y() == 0 && angleDelta.x() != 0) {
538 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
540 pixelDelta, angleDelta, angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling, device);
541 }
542
543 bool acceptVert;
544 bool acceptHorz;
545 // Both horizontal and vertical deltas: Send two wheel events.
546 // The first event contains the Qt 5 pixel and angle delta as points,
547 // and in addition the Qt 4 compatibility vertical angle delta.
548 acceptVert = handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
550 pixelDelta, angleDelta, angleDelta.y(), Qt::Vertical, mods, phase, source, invertedScrolling, device);
551
552 // The second event contains null pixel and angle points and the
553 // Qt 4 compatibility horizontal angle delta.
554 acceptHorz = handleWindowSystemEvent<QWindowSystemInterfacePrivate::WheelEvent>(window,
556 QPoint(), QPoint(), angleDelta.x(), Qt::Horizontal, mods, phase, source, invertedScrolling, device);
557
558 return acceptVert || acceptHorz;
559}
560
582
610QList<QEventPoint>
611 QWindowSystemInterfacePrivate::fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
613{
614 QList<QEventPoint> touchPoints;
615 QEventPoint::States states;
616
617 touchPoints.reserve(points.size());
620 while (point != end) {
621 QPointF globalPos = QHighDpi::fromNativePixels(point->area.center(), window);
622 QEventPoint p(point->id, point->state, globalPos, globalPos);
623 states |= point->state;
624 if (point->uniqueId >= 0)
625 QMutableEventPoint::setUniqueId(p, QPointingDeviceUniqueId::fromNumericId(point->uniqueId));
626 QMutableEventPoint::setPressure(p, point->pressure);
627 QMutableEventPoint::setRotation(p, point->rotation);
628 QMutableEventPoint::setEllipseDiameters(p, QHighDpi::fromNativePixels(point->area.size(), window));
629 QMutableEventPoint::setVelocity(p, QHighDpi::fromNativePixels(point->velocity, window));
630
631 // The local pos is not set: it will be calculated
632 // when the event gets processed by QGuiApplication.
633
634 touchPoints.append(p);
635 ++point;
636 }
637
638 // Determine the event type based on the combined point states.
639 if (type) {
645 }
646
647 return touchPoints;
648}
649
652{
654 p.id = pt.id();
656 area.moveCenter(pt.globalPosition());
657 // TODO store ellipseDiameters in QWindowSystemInterface::TouchPoint or just use QEventPoint
659 p.pressure = pt.pressure();
660 p.state = pt.state();
661 p.velocity = QHighDpi::toNativePixels(pt.velocity(), window);
662 return p;
663}
664
666 const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
667{
668 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
669 return handleTouchEvent<Delivery>(window, time, device, points, mods);
670}
671
672QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
673 const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
674{
675 if (!points.size()) // Touch events must have at least one point
676 return false;
677
678 if (!QPointingDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
679 return false;
680
682 QList<QEventPoint> touchPoints =
684
685 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, Delivery>(window,
686 timestamp, type, device, touchPoints, mods);
687}
688
689QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, const QPointingDevice *device,
690 Qt::KeyboardModifiers mods)
691{
692 unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
693 return handleTouchCancelEvent<Delivery>(window, time, device, mods);
694}
695
696QT_DEFINE_QPA_EVENT_HANDLER(bool, handleTouchCancelEvent, QWindow *window, ulong timestamp, const QPointingDevice *device,
697 Qt::KeyboardModifiers mods)
698{
699 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TouchEvent, Delivery>(window,
700 timestamp, QEvent::TouchCancel, device, QList<QEventPoint>(), mods);
701}
702
715{
716 QScreen *screen = new QScreen(platformScreen);
717
718 if (isPrimary)
720 else
722
725 screen->d_func()->updateGeometry();
726
727 emit qGuiApp->screenAdded(screen);
728
729 if (isPrimary)
730 emit qGuiApp->primaryScreenChanged(screen);
731}
732
742{
743 QScreen *screen = platformScreen->screen();
744
745 // Remove screen
746 const bool wasPrimary = QGuiApplication::primaryScreen() == screen;
749
750 if (qGuiApp) {
751 QScreen *newPrimaryScreen = QGuiApplication::primaryScreen();
752 if (wasPrimary && newPrimaryScreen)
753 emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
754
755 // Allow clients to manage windows that are affected by the screen going
756 // away, before we fall back to moving them to the primary screen.
757 emit qApp->screenRemoved(screen);
758
760 bool movingFromVirtualSibling = newPrimaryScreen
761 && newPrimaryScreen->handle()->virtualSiblings().contains(platformScreen);
762
763 // Move any leftover windows to the primary screen
764 const auto allWindows = QGuiApplication::allWindows();
765 for (QWindow *window : allWindows) {
766 if (!window->isTopLevel() || window->screen() != screen)
767 continue;
768
769 const bool wasVisible = window->isVisible();
770 window->setScreen(newPrimaryScreen);
771
772 // Re-show window if moved from a virtual sibling screen. Otherwise
773 // leave it up to the application developer to show the window.
774 if (movingFromVirtualSibling)
775 window->setVisible(wasVisible);
776 }
777 }
778 }
779
780 // Important to keep this order since the QSceen doesn't own the platform screen
781 delete screen;
782 delete platformScreen;
783}
784
792{
793 QScreen *newPrimaryScreen = newPrimary->screen();
794 qsizetype indexOfScreen = QGuiApplicationPrivate::screen_list.indexOf(newPrimaryScreen);
795 Q_ASSERT(indexOfScreen >= 0);
796 if (indexOfScreen == 0)
797 return;
798
799 QGuiApplicationPrivate::screen_list.swapItemsAt(0, indexOfScreen);
800 emit qGuiApp->primaryScreenChanged(newPrimaryScreen);
801}
802
804{
805 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenOrientationEvent>(screen, orientation);
806}
807
808void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry, const QRect &availableGeometry)
809{
810 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenGeometryEvent>(screen,
812 screen, geometry.topLeft()));
813}
814
816{
817 // Keep QHighDpiScaling::m_active in sync with platform screen state, in
818 // order to make scaling calls made during DPI change use the new state.
819 // FIXME: Remove when QHighDpiScaling::m_active has been removed.
821
822 const QDpi effectiveDpi = QPlatformScreen::overrideDpi(QDpi{dpiX, dpiY});
823 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent>(screen,
824 effectiveDpi.first, effectiveDpi.second);
825}
826
828{
829 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ScreenRefreshRateEvent>(screen, newRefreshRate);
830}
831
833{
834 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ThemeChangeEvent, Delivery>(window);
835}
836
837#if QT_CONFIG(draganddrop)
845QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *window, const QMimeData *dropData,
846 const QPoint &p, Qt::DropActions supportedActions,
847 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
848{
850 return QGuiApplicationPrivate::processDrag(window, dropData, pos, supportedActions, buttons, modifiers);
851}
852
853QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, const QMimeData *dropData,
854 const QPoint &p, Qt::DropActions supportedActions,
855 Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
856{
858 return QGuiApplicationPrivate::processDrop(window, dropData, pos, supportedActions, buttons, modifiers);
859}
860#endif // QT_CONFIG(draganddrop)
861
873
879
885
887{
888 platformSynthesizesMouse = v;
889}
890
892 const QPointF &local, const QPointF &global,
893 Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
894 qreal tangentialPressure, qreal rotation, int z,
895 Qt::KeyboardModifiers modifiers)
896{
897 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEvent>(window,
898 timestamp,
901 device, buttons, pressure,
902 xTilt, yTilt, tangentialPressure, rotation, z, modifiers);
903}
904
906 const QPointF &local, const QPointF &global,
907 Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
908 qreal tangentialPressure, qreal rotation, int z,
909 Qt::KeyboardModifiers modifiers)
910{
912 return handleTabletEvent(window, time, device, local, global,
913 buttons, pressure, xTilt, yTilt, tangentialPressure,
914 rotation, z, modifiers);
915}
916
918 int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
919 qreal tangentialPressure, qreal rotation, int z, qint64 uid,
920 Qt::KeyboardModifiers modifiers)
921{
924 return handleTabletEvent(window, timestamp, dev, local, global, buttons, pressure,
925 xTilt, yTilt, tangentialPressure, rotation, z, modifiers);
926}
927
929 int device, int pointerType, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt,
930 qreal tangentialPressure, qreal rotation, int z, qint64 uid,
931 Qt::KeyboardModifiers modifiers)
932{
934 return handleTabletEvent(window, time, local, global, device, pointerType, buttons, pressure,
935 xTilt, yTilt, tangentialPressure, rotation, z, uid, modifiers);
936}
937
939 bool inProximity, const QPointF &local, const QPointF &global,
940 Qt::MouseButtons buttons, int xTilt, int yTilt,
941 qreal tangentialPressure, qreal rotation, int z,
942 Qt::KeyboardModifiers modifiers)
943{
945 Q_UNUSED(local);
947 Q_UNUSED(buttons);
948 Q_UNUSED(xTilt);
949 Q_UNUSED(yTilt);
950 Q_UNUSED(tangentialPressure);
951 Q_UNUSED(rotation);
952 Q_UNUSED(z);
954 return inProximity
955 ? handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent>(timestamp, device)
956 : handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent>(timestamp, device);
957}
958
960 bool inProximity, const QPointF &local, const QPointF &global,
961 Qt::MouseButtons buttons, int xTilt, int yTilt,
962 qreal tangentialPressure, qreal rotation, int z,
963 Qt::KeyboardModifiers modifiers)
964{
966 return handleTabletEnterLeaveProximityEvent(window, time, device, inProximity,
967 local, global, buttons, xTilt, yTilt,
968 tangentialPressure, rotation, z, modifiers);
969}
970
971
973{
977 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletEnterProximityEvent>(timestamp, device);
978}
979
985
987{
991 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::TabletLeaveProximityEvent>(timestamp, device);
992}
993
999
1000#ifndef QT_NO_GESTURES
1002 Qt::NativeGestureType type, const QPointF &local, const QPointF &global, int fingerCount)
1003{
1004 return handleGestureEventWithValueAndDelta(window, timestamp, device, type, {}, {}, local, global, fingerCount);
1005}
1006
1008 Qt::NativeGestureType type, qreal value, const QPointF &local, const QPointF &global, int fingerCount)
1009{
1010 return handleGestureEventWithValueAndDelta(window, timestamp, device, type, value, {}, local, global, fingerCount);
1011}
1012
1015 const QPointF &local, const QPointF &global, int fingerCount)
1016{
1017 auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
1019
1020 return handleWindowSystemEvent<QWindowSystemInterfacePrivate::GestureEvent>(window,
1021 timestamp, type, device, fingerCount, localPos, globalPos, value, delta);
1022}
1023#endif // QT_NO_GESTURES
1024
1026{
1027 handleWindowSystemEvent<QWindowSystemInterfacePrivate::PlatformPanelEvent>(w);
1028}
1029
1030#ifndef QT_NO_CONTEXTMENU
1032 const QPoint &pos, const QPoint &globalPos,
1033 Qt::KeyboardModifiers modifiers)
1034{
1035 handleWindowSystemEvent<QWindowSystemInterfacePrivate::ContextMenuEvent>(window,
1036 mouseTriggered, pos, globalPos, modifiers);
1037}
1038#endif
1039
1040#if QT_CONFIG(whatsthis)
1041void QWindowSystemInterface::handleEnterWhatsThisEvent()
1042{
1043 handleWindowSystemEvent<QWindowSystemInterfacePrivate::WindowSystemEvent>(
1045}
1046#endif
1047
1048#ifndef QT_NO_DEBUG_STREAM
1050{
1051 QDebugStateSaver saver(dbg);
1052 dbg.nospace() << "TouchPoint(" << p.id << " @" << p.area << " normalized " << p.normalPosition
1053 << " press " << p.pressure << " vel " << p.velocity << " state " << (int)p.state;
1054 return dbg;
1055}
1056#endif
1057
1058// ------------------ Event dispatcher functionality ------------------
1059
1064bool QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
1065{
1067 if (!count)
1068 return false;
1070 qWarning().nospace()
1071 << "QWindowSystemInterface::flushWindowSystemEvents() invoked after "
1072 "QGuiApplication destruction, discarding " << count << " events.";
1074 return false;
1075 }
1077 // Post a FlushEvents event which will trigger a call back to
1078 // deferredFlushWindowSystemEvents from the Gui thread.
1080 handleWindowSystemEvent<QWindowSystemInterfacePrivate::FlushEventsEvent, AsynchronousDelivery>(flags);
1082 } else {
1083 sendWindowSystemEvents(flags);
1084 }
1085 return QWindowSystemInterfacePrivate::eventAccepted.loadRelaxed() > 0;
1086}
1087
1096
1097bool QWindowSystemInterface::sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
1098{
1099 int nevents = 0;
1100
1106 if (!event)
1107 break;
1108
1111 nevents++;
1112 } else {
1113 nevents++;
1115 }
1116
1117 // Record the accepted state for the processed event
1118 // (excluding flush events). This state can then be
1119 // returned by flushWindowSystemEvents().
1121 QWindowSystemInterfacePrivate::eventAccepted.storeRelaxed(event->eventAccepted);
1122
1123 delete event;
1124 }
1125
1126 return (nevents > 0);
1127}
1128
1133
1138
1143
1144// --------------------- QtTestLib support ---------------------
1145
1146// The following functions are used by testlib, and need to be synchronous to avoid
1147// race conditions with plugins delivering native events from secondary threads.
1148// FIXME: It seems unnecessary to export these wrapper functions, when qtestlib could access
1149// QWindowSystemInterface directly (by adding dependency to gui-private), see QTBUG-63146.
1150
1151Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
1152 Qt::MouseButtons state, Qt::MouseButton button,
1153 QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp)
1154{
1155 QPointF nativeLocal = QHighDpi::toNativeLocalPosition(local, window);
1157 QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window,
1158 timestamp, nativeLocal, nativeGlobal, state, button, type, mods);
1159}
1160
1161/*
1162 Used by QTest::simulateEvent() to synthesize key events during testing
1163*/
1164Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
1165{
1166#if defined(Q_OS_MACOS)
1167 // FIXME: Move into QTest::simulateEvent() and align with QGuiApplicationPrivate::processKeyEvent()
1168 auto timestamp = QWindowSystemInterfacePrivate::eventTime.elapsed();
1169 if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window, timestamp, k, mods, 0, 0, 0, text, autorep, count))
1170 return;
1171#endif
1172
1173 QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(window, t, k, mods, text, autorep, count);
1174}
1175
1176Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text = QString(), bool autorep = false, ushort count = 1)
1177{
1178#if QT_CONFIG(shortcut)
1179
1180 // FIXME: This method should not allow targeting a specific object, but should
1181 // instead forward the event to a window, which then takes care of normal event
1182 // propagation. We need to fix a lot of tests before we can refactor this (the
1183 // window needs to be exposed and active and have a focus object), so we leave
1184 // it as is for now. See QTBUG-48577.
1185
1187
1188 QKeyEvent qevent(QEvent::ShortcutOverride, k, mods, text, autorep, count);
1189 qevent.setTimestamp(timestamp);
1190
1191 QShortcutMap &shortcutMap = QGuiApplicationPrivate::instance()->shortcutMap;
1192 if (shortcutMap.state() == QKeySequence::NoMatch) {
1193 // Try sending as QKeyEvent::ShortcutOverride first
1195 if (qevent.isAccepted())
1196 return false;
1197 }
1198
1199 // Then as QShortcutEvent
1200 return shortcutMap.tryShortcut(&qevent);
1201#else
1202 Q_UNUSED(o);
1203 Q_UNUSED(timestamp);
1204 Q_UNUSED(k);
1205 Q_UNUSED(mods);
1206 Q_UNUSED(text);
1207 Q_UNUSED(autorep);
1208 Q_UNUSED(count);
1209 return false;
1210#endif
1211}
1212
1213Q_GUI_EXPORT void qt_handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global,
1214 QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods,
1215 Qt::ScrollPhase phase)
1216{
1217 QWindowSystemInterface::handleWheelEvent(window, local, global, pixelDelta, angleDelta, mods, phase);
1218}
1219
1220namespace QTest
1221{
1223 QInputDevice::Capabilities caps)
1224 {
1225 static qint64 nextId = 0x100000000;
1226 QPointingDevice *ret = new QPointingDevice("test touch device"_L1, nextId++,
1228 caps, 8, 0);
1230 return ret;
1231 }
1232}
1233
1235 const QList<QEventPoint> &points,
1236 Qt::KeyboardModifiers mods)
1237{
1238 return QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(window, device,
1240}
1241
1243 const QList<QEventPoint> &points,
1244 Qt::KeyboardModifiers mods)
1245{
1247}
1248
IOBluetoothDevice * device
\inmodule QtCore
Definition qatomic.h:112
\inmodule QtCore
Definition qbytearray.h:57
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
\inmodule QtCore
\inmodule QtCore
\inmodule QtCore
@ ExcludeUserInputEvents
Definition qeventloop.h:27
The QEventPoint class provides information about a point in a QPointerEvent.
Definition qeventpoint.h:20
QPointF globalPosition
the global position of this point.
Definition qeventpoint.h:43
qreal pressure
the pressure of this point.
Definition qeventpoint.h:31
int id
the ID number of this event point.
Definition qeventpoint.h:24
State state
the current state of the event point.
Definition qeventpoint.h:26
QSizeF ellipseDiameters
the width and height of the bounding ellipse of the touch point.
Definition qeventpoint.h:33
QVector2D velocity
a velocity vector, in units of pixels per second, in the coordinate.
Definition qeventpoint.h:34
Type
This enum type defines the valid event types in Qt.
Definition qcoreevent.h:51
@ NonClientAreaMouseButtonDblClick
Definition qcoreevent.h:215
@ ShortcutOverride
Definition qcoreevent.h:158
@ MouseMove
Definition qcoreevent.h:63
@ KeyPress
Definition qcoreevent.h:64
@ TouchCancel
Definition qcoreevent.h:264
@ MouseButtonPress
Definition qcoreevent.h:60
@ TouchUpdate
Definition qcoreevent.h:242
@ TouchBegin
Definition qcoreevent.h:241
@ NonClientAreaMouseMove
Definition qcoreevent.h:212
@ NonClientAreaMouseButtonRelease
Definition qcoreevent.h:214
@ MouseButtonDblClick
Definition qcoreevent.h:62
@ NonClientAreaMouseButtonPress
Definition qcoreevent.h:213
@ MouseButtonRelease
Definition qcoreevent.h:61
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
static Qt::KeyboardModifiers modifier_buttons
static QPlatformIntegration * platformIntegration()
static QList< QScreen * > screen_list
static QAbstractEventDispatcher * qt_qpa_core_dispatcher()
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
static void resetCachedDevicePixelRatio()
static QGuiApplicationPrivate * instance()
static QWindowList allWindows()
Returns a list of all the windows in the application.
QScreen * primaryScreen
the primary (or default) screen of the application.
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
static void updateHighDpiScaling()
static void registerDevice(const QInputDevice *dev)
static bool isRegistered(const QInputDevice *dev)
The QInputDevice class describes a device from which a QInputEvent originates.
DeviceType
This enum represents the type of device that generated a QPointerEvent.
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtCore
Definition qmimedata.h:16
\inmodule QtCore
Definition qmutex.h:313
\inmodule QtCore
Definition qmutex.h:281
\inmodule QtCore
Definition qobject.h:103
The QPlatformScreen class provides an abstraction for visual displays.
static QDpi overrideDpi(const QDpi &in)
QScreen * screen() const
The QPlatformWindow class provides an abstraction for top-level windows.
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
constexpr bool isNull() const noexcept
Returns true if both the x and y coordinates are set to 0, otherwise returns false.
Definition qpoint.h:125
constexpr int x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:130
constexpr int y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:135
static const QPointingDevice * tabletDevice(QInputDevice::DeviceType deviceType, QPointingDevice::PointerType pointerType, QPointingDeviceUniqueId uniqueId)
static QPointingDeviceUniqueId fromNumericId(qint64 id)
Constructs a unique pointer ID from numeric ID id.
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
static const QPointingDevice * primaryPointingDevice(const QString &seatName=QString())
Returns the primary pointing device (the core pointer, traditionally assumed to be a mouse) on the gi...
PointerType
This enum represents what is interacting with the pointing device.
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
Definition qrect.h:221
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QThread * currentThread()
Definition qthread.cpp:1039
\inmodule QtCore
Definition qurl.h:94
virtual bool sendEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *event)
ExposeEvent(QWindow *window, const QRegion &region)
GeometryChangeEvent(QWindow *window, const QRect &newGeometry)
static QWindowSystemEventHandler * eventHandler
static void installWindowSystemEventHandler(QWindowSystemEventHandler *handler)
static WindowSystemEvent * getWindowSystemEvent()
static void removeWindowSystemEvent(WindowSystemEvent *event)
static QWindowSystemInterface::TouchPoint toNativeTouchPoint(const QEventPoint &point, const QWindow *window)
static void removeWindowSystemEventhandler(QWindowSystemEventHandler *handler)
static WindowSystemEventList windowSystemEventQueue
static WindowSystemEvent * getNonUserInputWindowSystemEvent()
static WindowSystemEvent * peekWindowSystemEvent(EventType t)
static QList< QWindowSystemInterface::TouchPoint > toNativeTouchPoints(const EventPointList &pointList, const QWindow *window)
static QList< QEventPoint > fromNativeTouchPoints(const QList< QWindowSystemInterface::TouchPoint > &points, const QWindow *window, QEvent::Type *type=nullptr)
static bool flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Make Qt Gui process all events on the event queue immediately.
static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
Passes a native event identified by eventType to the window.
static bool handleGestureEventWithValueAndDelta(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, qreal value, const QPointF &delta, const QPointF &local, const QPointF &global, int fingerCount=2)
static bool handleTabletEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, const QPointF &local, const QPointF &global, Qt::MouseButtons buttons, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry, const QRect &newAvailableGeometry)
static bool handleGestureEventWithRealValue(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, qreal value, const QPointF &local, const QPointF &global, int fingerCount=2)
static bool sendWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
static void handleFileOpenEvent(const QString &fileName)
static void handleContextMenuEvent(QWindow *window, bool mouseTriggered, const QPoint &pos, const QPoint &globalPos, Qt::KeyboardModifiers modifiers)
static void handlePrimaryScreenChanged(QPlatformScreen *newPrimary)
Should be called whenever the primary screen changes.
static void deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
static void setSynchronousWindowSystemEvents(bool enable)
static void registerInputDevice(const QInputDevice *device)
static bool handleTabletLeaveProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
static void handleScreenAdded(QPlatformScreen *screen, bool isPrimary=false)
Should be called by the implementation whenever a new screen is added.
static bool handleExtendedKeyEvent(QWindow *window, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
static void handlePlatformPanelEvent(QWindow *window)
static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local=QPointF(), const QPointF &global=QPointF())
This method can be used to ensure leave and enter events are both in queue when moving from one QWind...
static void handleScreenRemoved(QPlatformScreen *screen)
Should be called by the implementation whenever a screen is removed.
static bool handleTabletEnterProximityEvent(ulong timestamp, int deviceType, int pointerType, qint64 uid)
static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation)
static bool handleShortcutEvent(QWindow *window, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &text=QString(), bool autorep=false, ushort count=1)
static bool handleGestureEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, Qt::NativeGestureType type, const QPointF &local, const QPointF &global, int fingerCount=0)
static void handleScreenRefreshRateChange(QScreen *screen, qreal newRefreshRate)
static bool handleTabletEnterLeaveProximityEvent(QWindow *window, ulong timestamp, const QPointingDevice *device, bool inProximity, const QPointF &local=QPointF(), const QPointF &global=QPointF(), Qt::MouseButtons buttons={}, int xTilt=0, int yTilt=0, qreal tangentialPressure=0, qreal rotation=0, int z=0, Qt::KeyboardModifiers modifiers=Qt::NoModifier)
static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY)
static bool handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods=Qt::NoModifier, Qt::ScrollPhase phase=Qt::NoScrollPhase, Qt::MouseEventSource source=Qt::MouseEventNotSynthesized)
\inmodule QtGui
Definition qwindow.h:63
EGLImageKHR int int EGLuint64KHR * modifiers
QString text
QPushButton * button
[2]
else opt state
[0]
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
T toNativePixels(const T &value, const C *context)
T toNativeLocalPosition(const T &value, const C *context)
T toNativeGlobalPosition(const T &value, const C *context)
T fromNativeLocalPosition(const T &value, const C *context)
T fromNativeGlobalPosition(const T &value, const C *context)
QRect fromNativeScreenGeometry(const QRect &nativeScreenGeometry, const QScreen *screen)
QRegion fromNativeLocalExposedRegion(const QRegion &pixelRegion, const QWindow *window)
T fromNativePixels(const T &value, const C *context)
T fromNative(const T &value, qreal scaleFactor, QPoint origin=QPoint(0, 0))
T fromNativeWindowGeometry(const T &value, const C *context)
Combined button and popup list for selecting options.
Q_GUI_EXPORT QPointingDevice * createTouchDevice(QInputDevice::DeviceType devType=QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps=QInputDevice::Capability::Position)
@ WindowNoState
Definition qnamespace.h:252
MouseButton
Definition qnamespace.h:56
@ Horizontal
Definition qnamespace.h:99
@ Vertical
Definition qnamespace.h:100
MouseEventSource
ScreenOrientation
Definition qnamespace.h:271
ApplicationState
Definition qnamespace.h:262
NativeGestureType
ScrollPhase
@ ScrollUpdate
FocusReason
#define qApp
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qGuiApp
QPair< qreal, qreal > QDpi
static int area(const QSize &s)
Definition qicon.cpp:153
#define qWarning
Definition qlogging.h:166
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
return ret
GLsizei const GLfloat * v
[13]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLuint64 GLenum void * handle
GLuint64 key
GLfloat GLfloat GLfloat w
[0]
GLboolean r
[2]
GLuint GLuint end
GLenum GLenum GLsizei count
GLenum type
GLbitfield flags
GLboolean enable
GLuint GLsizei const GLchar * message
GLsizei GLsizei GLchar * source
struct _cl_event * event
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
GLuint * states
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
QScreen * screen
[1]
Definition main.cpp:29
Q_GUI_EXPORT bool qt_handleTouchEventv2(QWindow *w, const QPointingDevice *device, const QList< QEventPoint > &points, Qt::KeyboardModifiers mods=Qt::NoModifier)
Q_GUI_EXPORT void qt_handleTouchEvent(QWindow *w, const QPointingDevice *device, const QList< QEventPoint > &points, Qt::KeyboardModifiers mods=Qt::NoModifier)
#define emit
#define Q_UNUSED(x)
unsigned int quint32
Definition qtypes.h:50
unsigned long ulong
Definition qtypes.h:35
ptrdiff_t qsizetype
Definition qtypes.h:165
long long qint64
Definition qtypes.h:60
unsigned short ushort
Definition qtypes.h:33
double qreal
Definition qtypes.h:187
ptrdiff_t qintptr
Definition qtypes.h:166
#define leave(x)
EventType
Definition qwasmevent.h:24
static uint nextId
static QPointingDevice::PointerType pointerType(unsigned currentCursor)
static QInputDevice::DeviceType deviceType(const UINT cursorType)
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
Q_GUI_EXPORT void qt_handleWheelEvent(QWindow *window, const QPointF &local, const QPointF &global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase)
QPointer< QWindow > qt_last_mouse_receiver
static bool handleWindowSystemEvent(Args ...args)
#define QT_DEFINE_QPA_EVENT_HANDLER(ReturnType, HandlerName,...)
Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp)
Q_GUI_EXPORT bool qt_sendShortcutOverrideEvent(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods, const QString &text=QString(), bool autorep=false, ushort count=1)
QUrl url("example.com")
[constructor-url-reference]
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
aWidget window() -> setWindowTitle("New Window Title")
[2]
QJSValueList args
QJSValue global
static bool handleEvent(Args ...)