7#include "private/qguiapplication_p.h"
8#include "private/qabstractfileiconprovider_p.h"
9#include <qpa/qplatformintegrationfactory_p.h>
10#include "private/qevent_p.h"
11#include "private/qeventpoint_p.h"
12#include "private/qiconloader_p.h"
15#include <qpa/qplatformfontdatabase.h>
16#include <qpa/qplatformwindow.h>
17#include <qpa/qplatformnativeinterface.h>
18#include <qpa/qplatformtheme.h>
19#include <qpa/qplatformintegration.h>
20#include <qpa/qplatformkeymapper.h>
22#include <QtCore/QAbstractEventDispatcher>
23#include <QtCore/QFileInfo>
24#include <QtCore/QStandardPaths>
25#include <QtCore/QVariant>
26#include <QtCore/private/qcoreapplication_p.h>
27#include <QtCore/private/qabstracteventdispatcher_p.h>
28#include <QtCore/private/qminimalflatset_p.h>
29#include <QtCore/qmutex.h>
30#include <QtCore/private/qthread_p.h>
31#include <QtCore/private/qlocking_p.h>
32#include <QtCore/private/qflatmap_p.h>
33#include <QtCore/qdir.h>
34#include <QtCore/qlibraryinfo.h>
35#include <QtCore/private/qnumeric_p.h>
37#if QT_CONFIG(accessibility)
43#include <private/qcolortrclut_p.h>
44#include <private/qscreen_p.h>
46#include <QtGui/qgenericpluginfactory.h>
47#include <QtGui/qstylehints.h>
48#include <QtGui/private/qstylehints_p.h>
49#include <QtGui/qinputmethod.h>
50#include <QtGui/qpixmapcache.h>
51#include <qpa/qplatforminputcontext.h>
52#include <qpa/qplatforminputcontext_p.h>
54#include <qpa/qwindowsysteminterface.h>
55#include <qpa/qwindowsysteminterface_p.h>
56#include "private/qwindow_p.h"
57#include "private/qicon_p.h"
58#include "private/qcursor_p.h"
60# include "private/qopenglcontext_p.h"
62#include "private/qinputdevicemanager_p.h"
63#include "private/qinputmethod_p.h"
64#include "private/qpointingdevice_p.h"
66#include <qpa/qplatformthemefactory_p.h>
68#if QT_CONFIG(draganddrop)
69#include <qpa/qplatformdrag.h>
70#include <private/qdnd_p.h>
74#include <qpa/qplatformcursor.h>
77#include <QtGui/QPixmap>
79#ifndef QT_NO_CLIPBOARD
80#include <QtGui/QClipboard>
84#include <QtCore/QLibrary>
88# include "private/qcore_mac_p.h"
89#elif defined(Q_OS_WIN)
90# include <QtCore/qt_windows.h>
91# include <QtCore/QLibraryInfo>
95#include <emscripten.h>
99#include <private/qvulkandefaultinstance_p.h>
102#include <qtgui_tracepoints_p.h>
104#include <private/qtools_p.h>
114#define CHECK_QAPP_INSTANCE(...) \
115 if (Q_LIKELY(QCoreApplication::instance())) { \
117 qWarning("Must construct a QGuiApplication first."); \
118 return __VA_ARGS__; \
174Q_CONSTINIT
int QGuiApplicationPrivate::m_fakeMouseSourcePointId = -1;
176#ifndef QT_NO_CLIPBOARD
192Q_CONSTINIT
qreal QGuiApplicationPrivate::m_maxDevicePixelRatio = 0.0;
199#if QT_CONFIG(animation)
206 (QGuiApplication::tr(
"QT_LAYOUT_DIRECTION",
207 "Translate this string to the string 'LTR' in left-to-right"
208 " languages or to 'RTL' in right-to-left languages (such as Hebrew"
209 " and Arabic) to get proper widget layout.") ==
"RTL"_L1);
246#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER { Qt::TopLeftCorner, -1, -1, -1, -1 }
271 if (*op ==
'+' || *op ==
'-' || *op ==
'x')
278 const int numberPos =
pos;
282 const int result =
a.mid(numberPos,
pos - numberPos).toInt(&
ok);
290 for (
int i = 0;
i < 4; ++
i) {
301 if (
result.xOffset >= 0) {
320 const QSize windowMinimumSize =
window->minimumSize();
321 const QSize windowMaximumSize =
window->maximumSize();
329 const QRect availableGeometry =
window->screen()->virtualGeometry();
341 window->setFramePosition(topLeft);
663 d->eventDispatcher->closingDown();
664 d->eventDispatcher =
nullptr;
666#ifndef QT_NO_CLIPBOARD
671#ifndef QT_NO_SESSIONMANAGER
672 delete d->session_manager;
673 d->session_manager =
nullptr;
676 QGuiApplicationPrivate::clearPalette();
680 d->cursor_list.clear();
689 delete QGuiApplicationPrivate::m_inputDeviceManager;
690 QGuiApplicationPrivate::m_inputDeviceManager =
nullptr;
706 lastTouchType(
QEvent::TouchEnd),
707 ownGlobalShareContext(
false)
711#ifndef QT_NO_SESSIONMANAGER
800 qWarning(
"QGuiApplication::setDesktopFileName: the specified desktop file name "
801 "ends with .desktop. For compatibility reasons, the .desktop suffix will "
802 "be removed. Please specify a desktop file name without .desktop suffix");
803 (*QGuiApplicationPrivate::desktopFileName).chop(8);
830 if (QGuiApplicationPrivate::self->modalWindowList.isEmpty())
832 return QGuiApplicationPrivate::self->modalWindowList.constFirst();
838 if (
p->blockedByModalWindow != shouldBeBlocked) {
839 p->blockedByModalWindow = shouldBeBlocked;
843 if (
c->isWindowType())
851 bool shouldBeBlocked =
false;
853 if (!popupType && !self->modalWindowList.isEmpty())
854 shouldBeBlocked = self->isWindowBlocked(
window);
868 self->modalWindowList.prepend(modal);
873 if (shouldBeBlocked) {
875 self->modalWindowList.removeFirst();
879 self->modalWindowList.prepend(modal);
893 self->modalWindowList.removeAll(
window);
924 *blockingWindow =
nullptr;
934 if (
window == modalWindow || modalWindow->isAncestorOf(
window, QWindow::IncludeTransients))
940 *blockingWindow = modalWindow;
947 if (current->isAncestorOf(modalWindow, QWindow::IncludeTransients)) {
948 *blockingWindow = modalWindow;
951 current = current->parent(QWindow::IncludeTransients);
956 Q_ASSERT_X(
false,
"QGuiApplication",
"internal error, a modal widget cannot be modeless");
1030 if (!
window->isTopLevel())
1041 if (
window->handle() &&
window->handle()->isEmbedded())
1079 QVarLengthArray<const QScreen *, 8> visitedScreens;
1081 if (visitedScreens.contains(
screen))
1086 if (sibling->geometry().contains(point))
1089 visitedScreens.append(sibling);
1141 if (!
qFuzzyIsNull(QGuiApplicationPrivate::m_maxDevicePixelRatio))
1142 return QGuiApplicationPrivate::m_maxDevicePixelRatio;
1144 QGuiApplicationPrivate::m_maxDevicePixelRatio = 1.0;
1146 QGuiApplicationPrivate::m_maxDevicePixelRatio =
qMax(QGuiApplicationPrivate::m_maxDevicePixelRatio,
screen->
devicePixelRatio());
1148 return QGuiApplicationPrivate::m_maxDevicePixelRatio;
1153 m_maxDevicePixelRatio = 0.0;
1163 return windowScreen->handle()->topLevelAt(devicePosition);
1208#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
1225 qCDebug(lcQpaPluginLoading) <<
"init_platform called with"
1226 <<
"pluginNamesWithArguments" << pluginNamesWithArguments
1227 <<
"platformPluginPath" << platformPluginPath
1228 <<
"platformThemeName" << platformThemeName;
1233 for (
const auto &pluginArgument : plugins) {
1242 argumentsKey[0] = argumentsKey.
at(0).toUpper();
1245 qCDebug(lcQpaPluginLoading) <<
"Attempting to load Qt platform plugin" <<
name <<
"with arguments" <<
arguments;
1250 if (availablePlugins.contains(
name)) {
1252 qCWarning(lcQpaPluginLoading).nospace().noquote()
1253 <<
"From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin.";
1255 qCInfo(lcQpaPluginLoading).nospace().noquote()
1256 <<
"Could not load the Qt platform plugin \"" <<
name <<
"\" in \""
1259 qCWarning(lcQpaPluginLoading).nospace().noquote()
1260 <<
"Could not find the Qt platform plugin \"" <<
name <<
"\" in \""
1264 qCDebug(lcQpaPluginLoading) <<
"Successfully loaded Qt platform plugin" <<
name;
1272 QString fatalMessage =
QStringLiteral(
"This application failed to start because no Qt platform plugin could be initialized. "
1273 "Reinstalling the application may fix this problem.\n");
1275 if (!availablePlugins.isEmpty())
1276 fatalMessage +=
"\nAvailable platform plugins are: %1.\n"_L1.arg(availablePlugins.join(
", "_L1));
1278#if defined(Q_OS_WIN)
1293 if (!platformThemeName.isEmpty()) {
1294 qCDebug(lcQpaTheme) <<
"Adding" << platformThemeName <<
"from environment to list of theme names";
1300 qCDebug(lcQpaTheme) <<
"Adding xdgdesktopportal to list of theme names";
1306 qCDebug(lcQpaTheme) <<
"Adding platform integration's theme names to list of theme names:" << platformIntegrationThemeNames;
1310 qCDebug(lcQpaTheme) <<
"Attempting to create platform theme" <<
themeName <<
"via QPlatformThemeFactory::create";
1322 qCDebug(lcQpaTheme) <<
"Attempting to create platform theme" <<
themeName <<
"via createPlatformTheme";
1334 qCDebug(lcQpaTheme) <<
"Failed to create platform theme; using \"null\" platform theme";
1340 if (!platformArguments.isEmpty()) {
1348 nativeInterface->setProperty(
name.constData(),
value);
1361 for (
int i = 0;
i < pluginList.size(); ++
i) {
1363 qsizetype colonPos = pluginSpec.indexOf(
':');
1373 qWarning(
"No such plugin for spec \"%s\"", pluginSpec.constData());
1377#if QT_CONFIG(commandlineparser)
1378void QGuiApplicationPrivate::addQtOptions(QList<QCommandLineOption> *options)
1380 QCoreApplicationPrivate::addQtOptions(options);
1382#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
1384 const bool x11 = sessionType ==
"x11";
1387 const bool x11 =
false;
1391 QGuiApplication::tr(
"QPA plugin. See QGuiApplication documentation for available options for each plugin."),
QStringLiteral(
"platformName[:options]")));
1393 QGuiApplication::tr(
"Path to the platform plugins."),
QStringLiteral(
"path")));
1395 QGuiApplication::tr(
"Platform theme."),
QStringLiteral(
"theme")));
1397 QGuiApplication::tr(
"Additional plugins to load, can be specified multiple times."),
QStringLiteral(
"plugin")));
1399 QGuiApplication::tr(
"Window geometry for the main window, using the X11-syntax, like 100x100+50+50."),
QStringLiteral(
"geometry")));
1401 QGuiApplication::tr(
"Default window icon."),
QStringLiteral(
"icon")));
1403 QGuiApplication::tr(
"Title of the first window."),
QStringLiteral(
"title")));
1405 QGuiApplication::tr(
"Sets the application's layout direction to Qt::RightToLeft (debugging helper).")));
1407 QGuiApplication::tr(
"Restores the application from an earlier session."),
QStringLiteral(
"session")));
1411 QGuiApplication::tr(
"Display name, overrides $DISPLAY."),
QStringLiteral(
"display")));
1413 QGuiApplication::tr(
"Instance name according to ICCCM 4.1.2.5."),
QStringLiteral(
"name")));
1415 QGuiApplication::tr(
"Disable mouse grabbing (useful in debuggers).")));
1417 QGuiApplication::tr(
"Force mouse grabbing (even when running in a debugger).")));
1419 QGuiApplication::tr(
"ID of the X11 Visual to use."),
QStringLiteral(
"id")));
1422 QGuiApplication::tr(
"Alias for --qwindowgeometry."),
QStringLiteral(
"geometry")));
1424 QGuiApplication::tr(
"Alias for --qwindowicon."),
QStringLiteral(
"icon")));
1426 QGuiApplication::tr(
"Alias for --qwindowtitle."),
QStringLiteral(
"title")));
1440#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
1441 platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
1443#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
1444 QList<QByteArray> platformArguments = platformName.
split(
':');
1448 const bool isWaylandSessionType =
qgetenv(
"XDG_SESSION_TYPE") ==
"wayland";
1450 QVector<QByteArray> preferredPlatformOrder;
1451 const bool defaultIsXcb = platformPluginBase ==
"xcb";
1452 const QByteArray xcbPlatformName = defaultIsXcb ? platformName :
"xcb";
1454 preferredPlatformOrder << xcbPlatformName;
1456 platformName.
clear();
1459 const bool defaultIsWayland = !defaultIsXcb && platformPluginBase.startsWith(
"wayland");
1460 const QByteArray waylandPlatformName = defaultIsWayland ? platformName :
"wayland";
1461 if (hasWaylandDisplay || isWaylandSessionType) {
1462 preferredPlatformOrder.
prepend(waylandPlatformName);
1464 if (defaultIsWayland)
1465 platformName.
clear();
1469 preferredPlatformOrder.append(platformName);
1471 platformName = preferredPlatformOrder.join(
';');
1474 bool platformExplicitlySelected =
false;
1476 if (!platformNameEnv.isEmpty()) {
1477 platformName = platformNameEnv;
1478 platformExplicitlySelected =
true;
1487 int j =
argc ? 1 : 0;
1491 if (*
argv[
i] !=
'-') {
1495 const bool xcbIsDefault = platformName.
startsWith(
"xcb");
1499 if (strcmp(
arg,
"-platformpluginpath") == 0) {
1502 }
else if (strcmp(
arg,
"-platform") == 0) {
1504 platformExplicitlySelected =
true;
1505 platformName =
argv[
i];
1507 }
else if (strcmp(
arg,
"-platformtheme") == 0) {
1510 }
else if (strcmp(
arg,
"-qwindowgeometry") == 0 || (xcbIsDefault && strcmp(
arg,
"-geometry") == 0)) {
1513 }
else if (strcmp(
arg,
"-qwindowtitle") == 0 || (xcbIsDefault && strcmp(
arg,
"-title") == 0)) {
1516 }
else if (strcmp(
arg,
"-qwindowicon") == 0 || (xcbIsDefault && strcmp(
arg,
"-icon") == 0)) {
1530 Q_UNUSED(platformExplicitlySelected);
1536 if (!
icon.isEmpty())
1555 "Creating the platform integration resulted in creating an event dispatcher");
1575#if defined(Q_OS_MACOS)
1583 bool loadTestability =
false;
1584 QList<QByteArray> pluginList;
1586#ifndef QT_NO_SESSIONMANAGER
1589# if defined(Q_OS_WIN)
1590 wchar_t guidstr[40];
1592 CoCreateGuid(&guid);
1593 StringFromGUID2(guid, guidstr, 40);
1595 CoCreateGuid(&guid);
1596 StringFromGUID2(guid, guidstr, 40);
1601 int j =
argc ? 1 : 0;
1605 if (*
argv[
i] !=
'-') {
1612 if (strcmp(
arg,
"-plugin") == 0) {
1614 pluginList <<
argv[
i];
1615 }
else if (strcmp(
arg,
"-reverse") == 0) {
1618 }
else if (strncmp(
arg,
"-psn_", 5) == 0) {
1622 QCFType<CFURLRef> bundleURL(CFBundleCopyBundleURL(CFBundleGetMainBundle()));
1624 kCFURLPOSIXPathStyle));
1625 if (qbundlePath.endsWith(
".app"_L1))
1629#ifndef QT_NO_SESSIONMANAGER
1630 }
else if (strcmp(
arg,
"-session") == 0 &&
i <
argc - 1) {
1636 session_key = session_id.mid(
p +1);
1637 session_id = session_id.left(
p);
1642 }
else if (strcmp(
arg,
"-testability") == 0) {
1643 loadTestability =
true;
1644 }
else if (strncmp(
arg,
"-style=", 7) == 0) {
1646 }
else if (strcmp(
arg,
"-style") == 0 &&
i <
argc - 1) {
1663 if (!envPlugins.isEmpty())
1664 pluginList += envPlugins.split(
',');
1680#if QT_CONFIG(animation)
1692 ownGlobalShareContext =
true;
1703#ifndef QT_NO_SESSIONMANAGER
1708#if QT_CONFIG(library)
1710 loadTestability =
true;
1712 if (loadTestability) {
1715 qCritical() <<
"Library qttestability load failed:" << testLib.errorString();
1717 typedef void (*TasInitialize)(
void);
1718 TasInitialize initFunction = (TasInitialize)testLib.resolve(
"qt_testability_init");
1720 qCritical(
"Library qttestability resolve failed!");
1770 if (ownGlobalShareContext) {
1776#if QT_CONFIG(vulkan)
1777 QVulkanDefaultInstance::cleanup();
1796void setOverrideCursor(
const QCursor &);
1797void changeOverrideCursor(
const QCursor &);
1798void restoreOverrideCursor();
1804static void setFont(
const QFont &,
const char *
className =
nullptr);
1807#ifndef QT_NO_CLIPBOARD
1850 return pi->keyMapper()->queryKeyboardModifiers();
1879 return pi ? pi->nativeInterface() :
nullptr;
1890 qWarning(
"QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function");
1894 return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) :
nullptr;
1923#if QT_CONFIG(accessibility)
1924 QAccessible::setRootObject(
qApp);
1939 switch (e->
type()) {
1961#if QT_CONFIG(wheelevent)
1967#if QT_CONFIG(tabletevent)
1987 if (
object->isWindowType()) {
2001 switch (e->
type()) {
2023 if (!topLevelWindow->handle())
2025 if (!topLevelWindow->close()) {
2050 if (!platformWindow)
2053 if (
event->spontaneous())
2159#ifndef QT_NO_GESTURES
2173#ifndef QT_NO_CONTEXTMENU
2183 qWarning() <<
"Unknown user input event type:" << e->
type;
2209 bool mouseMove =
false;
2210 bool mousePress =
false;
2215 qWarning(
"QGuiApplicationPrivate::processMouseEvent: Got NaN in mouse position");
2227 if (!mouseMove && positionChanged) {
2248 bool doubleClick =
false;
2249 auto persistentEPD = devPriv->pointById(0);
2255 const auto pressPos = persistentEPD->eventPoint.globalPressPosition();
2256 if (
qAbs(globalPoint.x() - pressPos.x()) > doubleClickDistance ||
2257 qAbs(globalPoint.y() - pressPos.y()) > doubleClickDistance)
2260 static unsigned long lastPressTimestamp = 0;
2264 doubleClick = e->
timestamp - lastPressTimestamp
2285 localPoint =
window->mapFromGlobal(globalPoint);
2298 QMouseEvent ev(
type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint,
2303 ev.QInputEvent::setTimestamp(e->
timestamp);
2304 cursor->pointerEvent(ev);
2310 Q_ASSERT(devPriv->pointById(0) == persistentEPD);
2313 QMutableEventPoint::setGlobalLastPosition(persistentEPD->eventPoint, lastGlobalPosition);
2314 persistentEPD =
nullptr;
2317 if (
window->d_func()->blockedByModalWindow && !
qApp->d_func()->popupActive()) {
2327 QGuiApplication::sendSpontaneousEvent(
window, &ev);
2332 QList<QWindowSystemInterface::TouchPoint>
points;
2353 const QList<QEventPoint> &touchPoints =
2364 QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
2366 dblClickEvent.setTimestamp(e->
timestamp);
2367 QGuiApplication::sendSpontaneousEvent(
window, &dblClickEvent);
2371 if (
auto *persistentEPD = devPriv->queryPointById(0)) {
2372 ev.setExclusiveGrabber(persistentEPD->eventPoint,
nullptr);
2373 ev.clearPassiveGrabbers(persistentEPD->eventPoint);
2380#if QT_CONFIG(wheelevent)
2388 localPoint =
window->mapFromGlobal(globalPoint);
2397 if (
window->d_func()->blockedByModalWindow) {
2406 QGuiApplication::sendSpontaneousEvent(
window, &ev);
2425#if defined(Q_OS_ANDROID)
2426 static bool backKeyPressAccepted =
false;
2427 static bool menuKeyPressAccepted =
false;
2430#if !defined(Q_OS_MACOS)
2436#if defined(Q_OS_ANDROID)
2453 QGuiApplication::sendSpontaneousEvent(
window, &ev);
2456 ev.setAccepted(
false);
2462 if (e->
key ==
Qt::Key_Back && !backKeyPressAccepted && !ev.isAccepted()) {
2465 }
else if (e->
key ==
Qt::Key_Menu && !menuKeyPressAccepted && !ev.isAccepted()) {
2477 if (e->
enter.
data()->d_func()->blockedByModalWindow) {
2493 auto epd = devPriv->queryPointById(
event.points().first().id());
2495 QMutableEventPoint::setVelocity(epd->eventPoint, {});
2504 if (e->
leave.
data()->d_func()->blockedByModalWindow) {
2520 if (previous == newFocus)
2525 if (platformWindow->isAlertState())
2526 platformWindow->setAlertState(
false);
2532 QCoreApplication::sendSpontaneousEvent(previous, &focusAboutToChange);
2545 QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
2566 self->notifyActiveWindowChange(previous);
2568 if (previousFocusObject !=
qApp->focusObject() ||
2574 (previous && previousFocusObject ==
nullptr &&
qApp->focusObject() ==
nullptr)) {
2575 self->_q_updateFocusObject(
qApp->focusObject());
2579 emit qApp->focusWindowChanged(newFocus);
2581 emit previous->activeChanged();
2583 emit newFocus->activeChanged();
2592 windowPrivate->windowState = wse->newState;
2594 if (newEffectiveState != originalEffectiveState)
2595 emit window->windowStateChanged(newEffectiveState);
2597 windowPrivate->updateVisibility();
2600 QGuiApplication::sendSpontaneousEvent(
window, &e);
2610 if (
window->screen() == wse->screen.data())
2613 if (
QWindow *topLevelWindow =
window->d_func()->topLevelWindow(QWindow::ExcludeTransients)) {
2615 topLevelWindow->d_func()->setTopLevelScreen(
screen,
false );
2617 topLevelWindow->setScreen(
nullptr);
2623 if (wde->window.isNull())
2630 if (wse->window.isNull())
2642 self->handleThemeChanged();
2648 for (
auto *
window : windows)
2649 QGuiApplication::sendSpontaneousEvent(
window, &themeChangeEvent);
2680 const QRect lastReportedGeometry =
window->d_func()->geometry;
2692 const bool isResize = actualGeometry.
size() != lastReportedGeometry.size()
2693 || requestedGeometry.
size() != actualGeometry.size();
2694 const bool isMove = actualGeometry.topLeft() != lastReportedGeometry.topLeft()
2695 || requestedGeometry.
topLeft() != actualGeometry.topLeft();
2697 window->d_func()->geometry = actualGeometry;
2699 if (isResize ||
window->d_func()->resizeEventPending) {
2700 QResizeEvent e(actualGeometry.size(), lastReportedGeometry.size());
2701 QGuiApplication::sendSpontaneousEvent(
window, &e);
2703 window->d_func()->resizeEventPending =
false;
2705 if (actualGeometry.width() != lastReportedGeometry.width())
2706 emit window->widthChanged(actualGeometry.width());
2707 if (actualGeometry.height() != lastReportedGeometry.height())
2708 emit window->heightChanged(actualGeometry.height());
2713 QMoveEvent e(actualGeometry.topLeft(), lastReportedGeometry.topLeft());
2714 QGuiApplication::sendSpontaneousEvent(
window, &e);
2716 if (actualGeometry.x() != lastReportedGeometry.x())
2718 if (actualGeometry.y() != lastReportedGeometry.y())
2727 if (e->
window.
data()->d_func()->blockedByModalWindow && !e->
window.
data()->d_func()->inClose) {
2746 QGuiApplication::sendSpontaneousEvent(
qApp, &
event);
2753 if (pointData.deviceId == deviceId)
2763#if QT_CONFIG(tabletevent)
2768 if (e->
buttons != pointData.state)
2774 bool localValid =
true;
2785 pointData.target =
window;
2788 window = pointData.target;
2792 pointData.target =
nullptr;
2803 Qt::MouseButtons stateChange = e->
buttons ^ pointData.state;
2806 if (check & stateChange) {
2816 tabletEvent.setAccepted(
false);
2818 QGuiApplication::sendSpontaneousEvent(
window, &tabletEvent);
2820 if (!tabletEvent.isAccepted()
2829 default: Q_UNREACHABLE();
2835 qCDebug(lcPtrDispatch) <<
"synthesizing mouse from tablet event" << mouseType
2846#if QT_CONFIG(tabletevent)
2852 QGuiApplication::sendSpontaneousEvent(
qGuiApp, &ev);
2860#if QT_CONFIG(tabletevent)
2866 QGuiApplication::sendSpontaneousEvent(
qGuiApp, &ev);
2872#ifndef QT_NO_GESTURES
2882 QGuiApplication::sendSpontaneousEvent(e->
window, &ev);
2891 if (e->
window->d_func()->blockedByModalWindow) {
2897 QGuiApplication::sendSpontaneousEvent(e->
window.
data(), &ev);
2900#ifndef QT_NO_CONTEXTMENU
2909 QGuiApplication::sendSpontaneousEvent(e->
window.
data(), &ev);
2927 constexpr qsizetype Prealloc =
decltype(devPriv->activePoints)::mapped_container_type::PreallocatedSize;
2928 QMinimalVarLengthFlatSet<QWindow *, Prealloc> windowsNeedingCancel;
2930 for (
auto &epd : devPriv->activePoints.values()) {
2932 windowsNeedingCancel.insert(
w);
2935 for (
QWindow *
w : windowsNeedingCancel)
2936 QGuiApplication::sendSpontaneousEvent(
w, &touchEvent);
2938 if (!self->synthesizedMousePoints.isEmpty() && !e->
synthetic()) {
2940 synthItEnd = self->synthesizedMousePoints.constEnd(); synthIt != synthItEnd; ++synthIt) {
2941 if (!synthIt->window)
2957 self->synthesizedMousePoints.clear();
2970 QVarLengthArray<QMutableTouchEvent, 2> touchEvents;
2976 for (
auto &tempPt : e->
points) {
2978 auto epd = devPriv->pointById(tempPt.id());
2979 auto &ep = epd->eventPoint;
2980 epd->eventPoint.setAccepted(
false);
2981 switch (tempPt.state()) {
2985 window = devPriv->firstActiveWindow();
2989 QMutableEventPoint::setWindow(ep,
window);
2994 qCDebug(lcPtrDispatch) <<
"delivering touch release to same window"
3001 qCDebug(lcPtrDispatch) <<
"delivering touch update to same window"
3008 qCWarning(lcPtrDispatch) <<
"skipping" << &tempPt <<
": no target window";
3016 QMutableEventPoint::setScenePosition(ep, tempPt.globalPosition());
3019 QMutableEventPoint::setPosition(ep,
window->mapFromGlobal(tempPt.globalPosition()));
3027 if (ev.target() ==
window.data()) {
3036 mte.setTarget(
window.data());
3037 touchEvents.append(mte);
3041 if (touchEvents.isEmpty())
3048 switch (touchEvent.touchPointStates()) {
3060 if (
window->d_func()->blockedByModalWindow && !
qApp->d_func()->popupActive()) {
3069 QGuiApplication::sendSpontaneousEvent(
window, &touchEvent);
3077 QGuiApplication::sendSpontaneousEvent(
window, &touchEvent);
3087 m_fakeMouseSourcePointId = touchEvent.
point(0).
id();
3088 qCDebug(lcPtrDispatch) <<
"synthesizing mouse events from touchpoint" << m_fakeMouseSourcePointId;
3090 if (m_fakeMouseSourcePointId >= 0) {
3091 const auto *touchPoint = touchEvent.pointById(m_fakeMouseSourcePointId);
3093 switch (touchPoint->state()) {
3102 Q_ASSERT(m_fakeMouseSourcePointId == touchPoint->id());
3103 m_fakeMouseSourcePointId = -1;
3110 touchPoint->position(), touchPoint->globalPosition(),
window));
3116 window->mapFromGlobal(touchPoint->globalPosition().toPoint()),
3117 touchPoint->globalPosition(),
3130 self->synthesizedMousePoints.clear();
3139 devPriv->removePointById(touchPoint.id());
3155 emit s->orientationChanged(
s->orientation());
3179 s->d_func()->updatePrimaryOrientation();
3200 s->d_func()->updateGeometry();
3225 s->d_func()->refreshRate =
rate;
3226 emit s->refreshRateChanged(
s->refreshRate());
3240 if (!
p->receivedExpose) {
3241 if (
p->resizeEventPending) {
3245 QGuiApplication::sendSpontaneousEvent(
window, &e);
3247 p->resizeEventPending =
false;
3256 p->receivedExpose =
true;
3262 const bool wasExposed =
p->exposed;
3271 qWarning() <<
"The cached device pixel ratio value was stale on window expose. "
3272 <<
"Please file a QTBUG which explains how to reproduce.";
3276 if (wasExposed &&
p->exposed && shouldSynthesizePaintEvents) {
3278 QCoreApplication::sendSpontaneousEvent(
window, &paintEvent);
3288 QCoreApplication::sendSpontaneousEvent(
window, &exposeEvent);
3296 if (!wasExposed &&
p->exposed && shouldSynthesizePaintEvents) {
3298 QCoreApplication::sendSpontaneousEvent(
window, &paintEvent);
3305 "The platform sent paint events without claiming support for it in QPlatformIntegration::capabilities()");
3311 QCoreApplication::sendSpontaneousEvent(e->
window, &paintEvent);
3318#if QT_CONFIG(draganddrop)
3325static void updateMouseAndModifierButtonState(Qt::MouseButtons buttons, Qt::KeyboardModifiers
modifiers)
3332 const QPoint &
p, Qt::DropActions supportedActions,
3333 Qt::MouseButtons buttons, Qt::KeyboardModifiers
modifiers)
3335 updateMouseAndModifierButtonState(buttons,
modifiers);
3339 if (!platformDrag || (
w &&
w->d_func()->blockedByModalWindow)) {
3351 QDragMoveEvent me(
p, supportedActions, dropData, buttons,
modifiers);
3360 QDragEnterEvent e(
p, supportedActions, dropData, buttons,
modifiers);
3363 lastAcceptedDropAction = e.dropAction();
3368 && (supportedActions & lastAcceptedDropAction)) {
3369 me.setDropAction(lastAcceptedDropAction);
3373 lastAcceptedDropAction = me.isAccepted() ?
3379 const QPoint &
p, Qt::DropActions supportedActions,
3380 Qt::MouseButtons buttons, Qt::KeyboardModifiers
modifiers)
3382 updateMouseAndModifierButtonState(buttons,
modifiers);
3386 QDropEvent de(
p, supportedActions, dropData, buttons,
modifiers);
3396#ifndef QT_NO_CLIPBOARD
3404 qWarning(
"QGuiApplication: Must construct a QGuiApplication before accessing a QClipboard");
3444 qGuiApp->d_func()->handlePaletteChanged();
3459void QGuiApplicationPrivate::clearPalette()
3476 qGuiApp->d_func()->handlePaletteChanged();
3510 return pf && pf->palette() ? *pf->palette() :
Qt::gray;
3515#if QT_DEPRECATED_SINCE(6, 0)
3558 qWarning(
"QGuiApplication::font(): no QGuiApplication instance and no application font set.");
3584#if QT_DEPRECATED_SINCE(6, 0)
3630 if (self->focus_window) {
3656 QGuiApplicationPrivate::self->notifyWindowIconChanged();
3704 emit q_func()->lastWindowClosed();
3727 if (!windowPrivate->participatesInLastWindowClosed())
3730 if (windowPrivate->treatAsVisible())
3763 windowSystemEvent->eventAccepted =
event.isAccepted();
3810 qWarning(
"setHighDpiScaleFactorRoundingPolicy must be called before creating the QGuiApplication instance");
3843 QCoreApplication::sendSpontaneousEvent(
qApp, &appActivate);
3847 QCoreApplication::sendSpontaneousEvent(
qApp, &appDeactivate);
3854 QCoreApplication::sendSpontaneousEvent(
qApp, &
event);
3962#ifndef QT_NO_SESSIONMANAGER
3966 return d->is_session_restored;
3972 return d->session_manager->sessionId();
3978 return d->session_manager->sessionKey();
3984 return d->is_saving_session;
4053 QGuiApplicationPrivate::self->notifyLayoutDirectionChange();
4084 return qGuiApp->d_func()->cursor_list.isEmpty() ?
nullptr : &
qGuiApp->d_func()->cursor_list.first();
4098 if (
qGuiApp->d_func()->cursor_list.isEmpty())
4100 qGuiApp->d_func()->cursor_list.removeFirst();
4118 cursor->changeCursor(
nullptr,
w);
4123 for (
int i = 0;
i < l.size(); ++
i) {
4142 cursor->clearOverrideCursor();
4148 for (
int i = 0;
i < l.size(); ++
i) {
4210 if (
qGuiApp->d_func()->cursor_list.isEmpty())
4212 qGuiApp->d_func()->cursor_list.removeFirst();
4213 if (
qGuiApp->d_func()->cursor_list.size() > 0) {
4283 if (!
qGuiApp->d_func()->inputMethod)
4285 return qGuiApp->d_func()->inputMethod;
4312 return QPoint(std::numeric_limits<int>::max(), std::numeric_limits<int>::max());
4316#if QT_CONFIG(draganddrop)
4317void QGuiApplicationPrivate::notifyDragStarted(
const QDrag *drag)
4327 if (!m_a8ColorProfile)
4329 return m_a8ColorProfile.get();
4337 if (!m_a32ColorProfile)
4339 return m_a32ColorProfile.get();
4352 emit q->focusObjectChanged(
object);
4368 if (!m_inputDeviceManager)
4371 return m_inputDeviceManager;
4395#if defined(Q_OS_WIN)
4401#if QT_CONFIG(wayland)
4404#if defined(Q_OS_VISIONOS)
4413#include "moc_qguiapplication.cpp"
IOBluetoothDevice * device
static void clearIconTypeCache()
Type loadRelaxed() const noexcept
QByteArray & prepend(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QList< QByteArray > split(char sep) const
Splits the byte array into subarrays wherever sep occurs, and returns the list of those arrays.
bool startsWith(QByteArrayView bv) const
char at(qsizetype i) const
Returns the byte at index position i in the byte array.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
void clear()
Clears the contents of the byte array and makes it null.
QByteArray first(qsizetype n) const &
The QClipboard class provides access to the window system clipboard.
The QCloseEvent class contains parameters that describe a close event.
static std::shared_ptr< QColorTrcLut > fromGamma(qreal gamma, Direction dir=BiLinear)
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
QCoreApplicationPrivate::Type application_type
static bool is_app_closing
static bool is_app_running
static QAbstractEventDispatcher * eventDispatcher
virtual bool canQuitAutomatically()
void * resolveInterface(const char *name, int revision) const
\macro Q_DECLARE_TR_FUNCTIONS(context)
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
bool event(QEvent *) override
\reimp
virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *)
static void quit()
\threadsafe
virtual bool notify(QObject *, QEvent *)
Sends event to receiver: {receiver}->event(event).
static void processEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Processes some pending events for the calling thread according to the specified flags.
void applicationNameChanged()
friend class QGuiApplication
static void setAttribute(Qt::ApplicationAttribute attribute, bool on=true)
Sets the attribute attribute if on is true; otherwise clears the attribute.
static QCoreApplication * instance() noexcept
Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
static void postEvent(QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
static int exec()
Enters the main event loop and waits until exit() is called.
static bool startingUp()
Returns true if an application object has not been created yet; otherwise returns false.
QString applicationName
the name of this application
The QCursor class provides a mouse cursor with an arbitrary shape.
static bool isAbsolutePath(const QString &path)
Returns true if path is absolute; returns false if it is relative.
static bool setCurrent(const QString &path)
Sets the application's current working directory to path.
static QString toNativeSeparators(const QString &pathName)
static QString currentPath()
Returns the absolute path of the application's current directory.
The QEventPoint class provides information about a point in a QPointerEvent.
int id
the ID number of this event point.
bool spontaneous() const
Returns true if the event originated outside the application (a system event); otherwise returns fals...
Type
This enum type defines the valid event types in Qt.
@ ApplicationPaletteChange
@ NonClientAreaMouseButtonDblClick
@ ApplicationLayoutDirectionChange
@ ApplicationWindowIconChange
@ NonClientAreaMouseButtonPress
Type type() const
Returns the event type.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
The QExposeEvent class contains event parameters for expose events. \inmodule QtGui.
bool exists() const
Returns true if the file system entry this QFileInfo refers to exists; otherwise returns false.
The QFileOpenEvent class provides an event that will be sent when there is a request to open a file o...
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
The QFocusEvent class contains event parameters for widget focus events.
static bool removeAllApplicationFonts()
\reentrant \inmodule QtGui
static QObject * create(const QString &, const QString &)
static Qt::ApplicationState applicationState
void maybeLastWindowClosed()
static void processLeaveEvent(QWindowSystemInterfacePrivate::LeaveEvent *e)
static void setApplicationState(Qt::ApplicationState state, bool forcePropagate=false)
static bool obey_desktop_settings
static QPointer< QWindow > currentDragWindow
static void processTabletEnterProximityEvent(QWindowSystemInterfacePrivate::TabletEnterProximityEvent *e)
QSessionManager * session_manager
bool canQuitAutomatically() override
static void updateBlockedStatus(QWindow *window)
void createPlatformIntegration()
static QWindow * currentMousePressWindow
static void processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e)
static void showModalWindow(QWindow *window)
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, qintptr *result)
QInputMethod * inputMethod
static void updatePalette()
static Qt::KeyboardModifiers modifier_buttons
bool lastWindowClosed() const
static void processPaintEvent(QWindowSystemInterfacePrivate::PaintEvent *e)
static void hideModalWindow(QWindow *window)
static QPlatformIntegration * platformIntegration()
static QWindowList window_list
static void processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e)
static QList< TabletPointData > tabletDevicePoints
virtual QPalette basePalette() const
static void processScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e)
void _q_updateFocusObject(QObject *object)
static QStyleHints * styleHints
static TabletPointData & tabletDevicePoint(qint64 deviceId)
static void processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)
static void processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent *e)
static void processScreenRefreshRateChange(QWindowSystemInterfacePrivate::ScreenRefreshRateEvent *e)
static QList< QObject * > generic_plugin_list
static void processScreenGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e)
static void processCloseEvent(QWindowSystemInterfacePrivate::CloseEvent *e)
static void processContextMenuEvent(QWindowSystemInterfacePrivate::ContextMenuEvent *e)
static QList< QScreen * > screen_list
static QPalette * app_pal
static QEvent::Type contextMenuEventType()
static void processApplicationTermination(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
static void resetCachedDevicePixelRatio()
static QClipboard * qt_clipboard
static void processFocusWindowEvent(QWindowSystemInterfacePrivate::FocusWindowEvent *e)
static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e)
static Qt::HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy
static QString * desktopFileName
static Qt::MouseButtons mouse_buttons
virtual bool windowNeverBlocked(QWindow *window) const
static void processGestureEvent(QWindowSystemInterfacePrivate::GestureEvent *e)
static QWindow * currentMouseWindow
~QGuiApplicationPrivate()
static QString styleOverride
static QInputDeviceManager * inputDeviceManager()
QPixmap getPixmapCursor(Qt::CursorShape cshape)
static void processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
bool isWindowBlocked(QWindow *window, QWindow **blockingWindow=nullptr) const
const QColorTrcLut * colorProfileForA8Text()
static QPlatformTheme * platform_theme
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
static void processScreenLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e)
static void processPlatformPanelEvent(QWindowSystemInterfacePrivate::PlatformPanelEvent *e)
static void captureGlobalModifierState(QEvent *e)
virtual void handlePaletteChanged(const char *className=nullptr)
static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e)
QGuiApplicationPrivate(int &argc, char **argv)
static void processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
static QString * platform_name
static void processTabletLeaveProximityEvent(QWindowSystemInterfacePrivate::TabletLeaveProximityEvent *e)
static QWindow * focus_window
void createEventDispatcher() override
Called from QCoreApplication::init()
virtual void handleThemeChanged()
static Qt::MouseButton mousePressButton
static bool sendQWindowEventToQPlatformWindow(QWindow *window, QEvent *event)
static void processWindowDevicePixelRatioChangedEvent(QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *e)
static QString * displayName
static struct QGuiApplicationPrivate::QLastCursorPosition lastCursorPosition
static void processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
QWindowList modalWindowList
virtual void notifyActiveWindowChange(QWindow *previous)
static bool setPalette(const QPalette &palette)
virtual void notifyLayoutDirectionChange()
static QPlatformIntegration * platform_integration
static bool quitOnLastWindowClosed
void eventDispatcherReady() override
const QColorTrcLut * colorProfileForA32Text()
virtual Qt::WindowModality defaultModality() const
static void processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
static void processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
static void applyWindowGeometrySpecificationTo(QWindow *window)
static void processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e)
static QPlatformTheme * platformTheme()
virtual void notifyWindowIconChanged()
Q_SLOT void setBadgeNumber(qint64 number)
Sets the application's badge to number.
static QFunctionPointer platformFunction(const QByteArray &function)
static void setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy policy)
static Qt::ApplicationState applicationState()
static void setQuitOnLastWindowClosed(bool quit)
static QPlatformNativeInterface * platformNativeInterface()
bool notify(QObject *, QEvent *) override
\reimp
static QWindowList topLevelWindows()
Returns a list of the top-level windows in the application.
static QWindow * modalWindow()
Returns the most recently shown modal window.
static QWindow * topLevelAt(const QPoint &pos)
Returns the top level window at the given position pos, if any.
static void setDesktopFileName(const QString &name)
static void setFont(const QFont &)
Changes the default application font to font.
bool isSavingSession() const
static QWindowList allWindows()
Returns a list of all the windows in the application.
static QClipboard * clipboard()
Returns the object for interacting with the clipboard.
QScreen * primaryScreen
the primary (or default) screen of the application.
bool isSessionRestored() const
Returns true if the application has been restored from an earlier \l{Session Management}{session}; ot...
static QPalette palette()
Returns the current application palette.
static QObject * focusObject()
Returns the QObject in currently active window that will be final receiver of events tied to focus,...
static void setPalette(const QPalette &pal)
Changes the application palette to pal.
static QCursor * overrideCursor()
Returns the active application override cursor.
bool quitOnLastWindowClosed
whether the application implicitly quits when the last window is closed.
static QFont font()
Returns the default application font.
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override
static QStyleHints * styleHints()
Returns the application's style hints.
static QWindow * focusWindow()
Returns the QWindow that receives events tied to focus, such as key events.
static void changeOverrideCursor(const QCursor &)
Changes the currently active application override cursor to cursor.
static void setApplicationDisplayName(const QString &name)
qreal devicePixelRatio() const
Returns the highest screen device pixel ratio found on the system.
void applicationDisplayNameChanged()
QString sessionKey() const
Returns the session key in the current \l{Session Management}{session}.
static void setLayoutDirection(Qt::LayoutDirection direction)
static QInputMethod * inputMethod()
returns the input method.
static Qt::KeyboardModifiers keyboardModifiers()
Returns the current state of the modifier keys on the keyboard.
static Qt::KeyboardModifiers queryKeyboardModifiers()
Queries and returns the state of the modifier keys on the keyboard.
static void setDesktopSettingsAware(bool on)
Sets whether Qt should use the system's standard colors, fonts, etc., to on.
QString applicationDisplayName
the user-visible name of this application
static void setOverrideCursor(const QCursor &)
Sets the application override cursor to cursor.
bool event(QEvent *) override
\reimp
static void restoreOverrideCursor()
Undoes the last setOverrideCursor().
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.
~QGuiApplication()
Destructs the application.
QString platformName
The name of the underlying platform plugin.
QString sessionId() const
Returns the current \l{Session Management}{session's} identifier.
QString desktopFileName
the base name of the desktop entry for this application
Qt::LayoutDirection layoutDirection
the default layout direction for this application
static QScreen * screenAt(const QPoint &point)
Returns the screen at point, or \nullptr if outside of any screen.
static int exec()
Enters the main event loop and waits until exit() is called, and then returns the value that was set ...
static QList< QScreen * > screens()
Returns a list of all the screens associated with the windowing system the application is connected t...
QIcon windowIcon
the default window icon
static Qt::MouseButtons mouseButtons()
Returns the current state of the buttons on the mouse.
static Qt::HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy()
static void setWindowIcon(const QIcon &icon)
static void updateHighDpiScaling()
static void initHighDpiScaling()
static QIconLoader * instance()
static void clearIconCache()
The QIcon class provides scalable icons in different modes and states.
static QIcon fromTheme(const QString &name)
The QKeyEvent class describes a key event.
static bool isDebugBuild() noexcept Q_DECL_CONST_FUNCTION
static QStringList platformPluginArguments(const QString &platformName)
Returns additional arguments to the platform plugin matching platformName which can be specified as a...
static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION
\inmodule QtCore \reentrant
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
void append(parameter_type t)
The QMoveEvent class contains event parameters for move events.
static Q_GUI_EXPORT void update(const QEventPoint &from, QEventPoint &to)
static Q_GUI_EXPORT void setTimestamp(QEventPoint &p, ulong t)
static QWindow * window(const QEventPoint &p)
static QMutableSinglePointEvent * from(QSinglePointEvent *e)
The QNativeGestureEvent class contains parameters that describe a gesture event. \inmodule QtGui.
QAtomicPointer< QThreadData > threadData
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void setFormat(const QSurfaceFormat &format)
Sets the format the OpenGL context should be compatible with.
The QPaintEvent class contains event parameters for paint events.
The QPalette class contains color groups for each widget state.
ResolveMask resolveMask() const
QPalette resolve(const QPalette &other) const
Returns a new QPalette that is a union of this instance and other.
static void clear()
Removes all pixmaps from the cache.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
static void setInputMethodAccepted(bool accepted)
The QPlatformInputContext class abstracts the input method dependent data and composing state.
virtual void setFocusObject(QObject *object)
This virtual method gets called to notify updated focus to object.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr void setY(int y) noexcept
Sets the y coordinate of this point to the given y coordinate.
constexpr void setX(int x) noexcept
Sets the x coordinate of this point to the given x coordinate.
T * data() const noexcept
bool isNull() const noexcept
static QPointingDevicePrivate * get(QPointingDevice *q)
qint64 numericId
the numeric unique ID of the token represented by a touchpoint
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
QPointingDeviceUniqueId uniqueId
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
The QResizeEvent class contains event parameters for resize events.
The QScreen class is used to query screen properties. \inmodule QtGui.
qreal devicePixelRatio
the screen's ratio between physical pixels and device-independent pixels
QList< QScreen * > virtualSiblings() const
Get the screen's virtual siblings.
Qt::ScreenOrientation orientation
the screen orientation
QPlatformScreen * handle() const
Get the platform screen handle.
The QSessionManager class provides access to the session manager.
Qt::MouseButton button() const
Returns the button that caused the event.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
static QString locate(StandardLocation type, const QString &fileName, LocateOptions options=LocateFile)
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const ushort * utf16() const
Returns the QString as a '\0\'-terminated array of unsigned shorts.
static QString fromLocal8Bit(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
static QStyleHintsPrivate * get(QStyleHints *q)
The QStyleHints class contains platform specific hints and settings. \inmodule QtGui.
QEventPoint & point(int touchId)
The QTouchEvent class contains parameters that describe a touch event.
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
static Q_CORE_EXPORT int compare(const QVersionNumber &v1, const QVersionNumber &v2) noexcept
Compares v1 with v2 and returns an integer less than, equal to, or greater than zero,...
static QWindowPrivate * get(QWindow *window)
static Qt::WindowState effectiveState(Qt::WindowStates)
Qt::ApplicationState newState
QPointer< QWindow > window
QPointer< QWindow > enter
QPointer< QWindow > window
QPointer< QWindow > focused
QPointer< QWindow > window
Qt::NativeGestureType type
QPointer< QWindow > leave
Qt::MouseEventSource source
QPointer< QWindow > window
QPointer< QScreen > screen
QPointer< QScreen > screen
Qt::ScreenOrientation orientation
QPointer< QScreen > screen
QPointer< QScreen > screen
static bool platformSynthesizesMouse
QList< QEventPoint > points
QPointer< QWindow > window
Qt::MouseEventSource source
@ ApplicationStateChanged
@ ScreenLogicalDotsPerInch
@ WindowDevicePixelRatioChanged
static QList< QEventPoint > fromNativeTouchPoints(const QList< QWindowSystemInterface::TouchPoint > &points, const QWindow *window, QEvent::Type *type=nullptr)
static QElapsedTimer eventTime
static bool flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Make Qt Gui process all events on the event queue immediately.
static void deferredFlushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags)
static bool handleCloseEvent(QWindow *window)
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)
Qt::WindowFlags flags
the window flags of the window
virtual QObject * focusObject() const
Returns the QObject that will be the final receiver of events tied focus, such as key events.
Qt::WindowModality modality
the modality of the window
EGLImageKHR int int EGLuint64KHR * modifiers
QList< QVariant > arguments
T toNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
constexpr bool isAsciiDigit(char32_t c) noexcept
@ MouseEventSynthesizedByQt
@ MouseEventNotSynthesized
@ AA_SynthesizeMouseForUnhandledTabletEvents
@ AA_DontShowShortcutsInContextMenus
@ AA_SynthesizeMouseForUnhandledTouchEvents
@ AA_SynthesizeTouchForUnhandledMouseEvents
HighDpiScaleFactorRoundingPolicy
@ ActiveWindowFocusReason
#define QT_WARNING_DISABLE_DEPRECATED
void Q_CORE_EXPORT qt_call_post_routines()
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qIsNaN(qfloat16 f) noexcept
bool qIsInf(qfloat16 f) noexcept
static bool needsWindowBlockedEvent(const QWindow *w)
static void applyCursor(QWindow *w, QCursor c)
Q_CORE_EXPORT void qt_call_post_routines()
static void init_plugins(const QList< QByteArray > &pluginList)
static Q_CONSTINIT unsigned applicationResourceFlags
static void initFontUnlocked()
static void clearFontUnlocked()
static void clearOverrideCursor(const QList< QScreen * > &screens)
void qRegisterGuiVariant()
static void applyWindowCursor(const QList< QWindow * > &l)
static Q_CONSTINIT bool force_reverse
static QWindowGeometrySpecification windowGeometrySpecification
static void unsetCursor(QWindow *w)
static bool qt_detectRTLLanguage()
static bool checkNeedPortalSupport()
static Q_CONSTINIT Qt::LayoutDirection effective_layout_direction
#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER
static Q_CONSTINIT int mouseDoubleClickDistance
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
static Q_CONSTINIT Qt::LayoutDirection layout_direction
static Q_CONSTINIT int touchDoubleTapDistance
static void initThemeHints()
static void applyOverrideCursor(const QList< QScreen * > &screens, const QCursor &c)
static Q_CONSTINIT QBasicMutex applicationFontMutex
static int nextGeometryToken(const QByteArray &a, int &pos, char *op)
Q_CONSTINIT Q_GUI_EXPORT bool qt_is_tty_app
#define CHECK_QAPP_INSTANCE(...)
@ ApplicationFontExplicitlySet
static void updateBlockedStatusRecursion(QWindow *window, bool shouldBeBlocked)
static Q_CONSTINIT qreal fontSmoothingGamma
void qt_cleanupFontDatabase()
void qRegisterGuiGetInterpolator()
QPair< qreal, qreal > QDpi
#define Q_LOGGING_CATEGORY(name,...)
#define qCInfo(category,...)
#define qCWarning(category,...)
#define qCDebug(category,...)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
#define QT_NATIVE_INTERFACE_RETURN_IF(NativeInterface, baseType)
constexpr T qAbs(const T &t)
static QString themeName()
QOpenGLContext * qt_gl_global_share_context()
void qt_gl_set_global_share_context(QOpenGLContext *context)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * message
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLdouble GLdouble q
#define Q_ASSERT_X(cond, x, msg)
#define qPrintable(string)
#define QStringLiteral(str)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) noexcept
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept
#define Q_TRACE_PARAM_REPLACE(in, out)
#define Q_TRACE_SCOPE(x,...)
#define Q_TRACE_INSTRUMENT(provider)
Q_GUI_EXPORT QWindowPrivate * qt_window_private(QWindow *window)
bool testFlag(MaskType mask, FlagType flag)
QT_BEGIN_NAMESPACE constexpr const wchar_t * themeNames[]
const char className[16]
[1]
myObject disconnect()
[26]
void processTouchEvent()
[toString-overload]
Q_GUI_EXPORT QPoint toPoint() const noexcept
void applyTo(QWindow *window) const
static QWindowGeometrySpecification fromArgument(const QByteArray &a)