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
QGuiApplication Class Reference

\macro qGuiApp More...

#include <qguiapplication.h>

+ Inheritance diagram for QGuiApplication:
+ Collaboration diagram for QGuiApplication:

Signals

void fontDatabaseChanged ()
 This signal is emitted when the available fonts have changed.
 
void screenAdded (QScreen *screen)
 This signal is emitted whenever a new screen screen has been added to the system.
 
void screenRemoved (QScreen *screen)
 This signal is emitted whenever a screen is removed from the system.
 
void primaryScreenChanged (QScreen *screen)
 
void lastWindowClosed ()
 This signal is emitted from exec() when the last visible \l{Primary and Secondary Windows}{primary window} (i.e.
 
void focusObjectChanged (QObject *focusObject)
 This signal is emitted when final receiver of events tied to focus is changed.
 
void focusWindowChanged (QWindow *focusWindow)
 This signal is emitted when the focused window changes.
 
void applicationStateChanged (Qt::ApplicationState state)
 
void layoutDirectionChanged (Qt::LayoutDirection direction)
 
void commitDataRequest (QSessionManager &sessionManager)
 
void saveStateRequest (QSessionManager &sessionManager)
 
void applicationDisplayNameChanged ()
 
- Signals inherited from QCoreApplication
void aboutToQuit (QPrivateSignal)
 This signal is emitted when the application is about to quit the main event loop, e.g.
 
void organizationNameChanged ()
 
void organizationDomainChanged ()
 
void applicationNameChanged ()
 
void applicationVersionChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QGuiApplication (int &argc, char **argv, int=ApplicationFlags)
 Initializes the window system and constructs an application object with argc command line arguments in argv.
 
 ~QGuiApplication ()
 Destructs the application.
 
Q_SLOT void setBadgeNumber (qint64 number)
 Sets the application's badge to number.
 
qreal devicePixelRatio () const
 Returns the highest screen device pixel ratio found on the system.
 
bool notify (QObject *, QEvent *) override
 \reimp
 
bool isSessionRestored () const
 Returns true if the application has been restored from an earlier \l{Session Management}{session}; otherwise returns false.
 
QString sessionId () const
 Returns the current \l{Session Management}{session's} identifier.
 
QString sessionKey () const
 Returns the session key in the current \l{Session Management}{session}.
 
bool isSavingSession () const
 
- Public Member Functions inherited from QCoreApplication
 QCoreApplication (int &argc, char **argv, int=ApplicationFlags)
 Constructs a Qt core application.
 
 ~QCoreApplication ()
 Destroys the QCoreApplication object.
 
void installNativeEventFilter (QAbstractNativeEventFilter *filterObj)
 Installs an event filter filterObj for all native events received by the application in the main thread.
 
void removeNativeEventFilter (QAbstractNativeEventFilter *filterObj)
 Removes an event filterObject from this object.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 

Static Public Member Functions

static void setApplicationDisplayName (const QString &name)
 
static QString applicationDisplayName ()
 
static void setDesktopFileName (const QString &name)
 
static QString desktopFileName ()
 
static QWindowList allWindows ()
 Returns a list of all the windows in the application.
 
static QWindowList topLevelWindows ()
 Returns a list of the top-level windows in the application.
 
static QWindowtopLevelAt (const QPoint &pos)
 Returns the top level window at the given position pos, if any.
 
static void setWindowIcon (const QIcon &icon)
 
static QIcon windowIcon ()
 
static QString platformName ()
 
static QWindowmodalWindow ()
 Returns the most recently shown modal window.
 
static QWindowfocusWindow ()
 Returns the QWindow that receives events tied to focus, such as key events.
 
static QObjectfocusObject ()
 Returns the QObject in currently active window that will be final receiver of events tied to focus, such as key events.
 
static QScreenprimaryScreen ()
 
static QList< QScreen * > screens ()
 Returns a list of all the screens associated with the windowing system the application is connected to.
 
static QScreenscreenAt (const QPoint &point)
 Returns the screen at point, or \nullptr if outside of any screen.
 
static QCursoroverrideCursor ()
 Returns the active application override cursor.
 
static void setOverrideCursor (const QCursor &)
 Sets the application override cursor to cursor.
 
static void changeOverrideCursor (const QCursor &)
 Changes the currently active application override cursor to cursor.
 
static void restoreOverrideCursor ()
 Undoes the last setOverrideCursor().
 
static QFont font ()
 Returns the default application font.
 
static void setFont (const QFont &)
 Changes the default application font to font.
 
static QClipboardclipboard ()
 Returns the object for interacting with the clipboard.
 
static QPalette palette ()
 Returns the current application palette.
 
static void setPalette (const QPalette &pal)
 Changes the application palette to pal.
 
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 Qt::MouseButtons mouseButtons ()
 Returns the current state of the buttons on the mouse.
 
static void setLayoutDirection (Qt::LayoutDirection direction)
 
static Qt::LayoutDirection layoutDirection ()
 
static bool isRightToLeft ()
 Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false.
 
static bool isLeftToRight ()
 Returns true if the application's layout direction is Qt::LeftToRight; otherwise returns false.
 
static QStyleHintsstyleHints ()
 Returns the application's style hints.
 
static void setDesktopSettingsAware (bool on)
 Sets whether Qt should use the system's standard colors, fonts, etc., to on.
 
static bool desktopSettingsAware ()
 Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.
 
static QInputMethodinputMethod ()
 returns the input method.
 
static QPlatformNativeInterfaceplatformNativeInterface ()
 
static QFunctionPointer platformFunction (const QByteArray &function)
 
static void setQuitOnLastWindowClosed (bool quit)
 
static bool quitOnLastWindowClosed ()
 
static Qt::ApplicationState applicationState ()
 
static void setHighDpiScaleFactorRoundingPolicy (Qt::HighDpiScaleFactorRoundingPolicy policy)
 
static Qt::HighDpiScaleFactorRoundingPolicy highDpiScaleFactorRoundingPolicy ()
 
static int exec ()
 Enters the main event loop and waits until exit() is called, and then returns the value that was set to exit() (which is 0 if exit() is called via quit()).
 
static void sync ()
 
- Static Public Member Functions inherited from QCoreApplication
static QStringList arguments ()
 
static void setAttribute (Qt::ApplicationAttribute attribute, bool on=true)
 Sets the attribute attribute if on is true; otherwise clears the attribute.
 
static bool testAttribute (Qt::ApplicationAttribute attribute)
 Returns true if attribute attribute is set; otherwise returns false.
 
static void setOrganizationDomain (const QString &orgDomain)
 
static QString organizationDomain ()
 
static void setOrganizationName (const QString &orgName)
 [11]
 
static QString organizationName ()
 
static void setApplicationName (const QString &application)
 
static QString applicationName ()
 
static void setApplicationVersion (const QString &version)
 
static QString applicationVersion ()
 
static void setSetuidAllowed (bool allow)
 
static bool isSetuidAllowed ()
 
static QCoreApplicationinstance () noexcept
 Returns a pointer to the application's QCoreApplication (or QGuiApplication/QApplication) instance.
 
static int exec ()
 Enters the main event loop and waits until exit() is called.
 
static void processEvents (QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
 Processes some pending events for the calling thread according to the specified flags.
 
static void processEvents (QEventLoop::ProcessEventsFlags flags, int maxtime)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Processes pending events for the calling thread for ms milliseconds or until there are no more events to process, whichever is shorter.
 
static void processEvents (QEventLoop::ProcessEventsFlags flags, QDeadlineTimer deadline)
 
static bool sendEvent (QObject *receiver, QEvent *event)
 Sends event event directly to receiver receiver, using the notify() function.
 
static void postEvent (QObject *receiver, QEvent *event, int priority=Qt::NormalEventPriority)
 
static void sendPostedEvents (QObject *receiver=nullptr, int event_type=0)
 Immediately dispatches all events which have been previously queued with QCoreApplication::postEvent() and which are for the object receiver and have the event type event_type.
 
static void removePostedEvents (QObject *receiver, int eventType=0)
 
static QAbstractEventDispatchereventDispatcher ()
 Returns a pointer to the event dispatcher object for the main thread.
 
static void setEventDispatcher (QAbstractEventDispatcher *eventDispatcher)
 Sets the event dispatcher for the main thread to eventDispatcher.
 
static bool startingUp ()
 Returns true if an application object has not been created yet; otherwise returns false.
 
static bool closingDown ()
 Returns true if the application objects are being destroyed; otherwise returns false.
 
static QString applicationDirPath ()
 Returns the directory that contains the application executable.
 
static QString applicationFilePath ()
 Returns the file path of the application executable.
 
static qint64 applicationPid () Q_DECL_CONST_FUNCTION
 
static bool installTranslator (QTranslator *messageFile)
 Adds the translation file translationFile to the list of translation files to be used for translations.
 
static bool removeTranslator (QTranslator *messageFile)
 Removes the translation file translationFile from the list of translation files used by this application.
 
static QString translate (const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
 \threadsafe
 
static bool isQuitLockEnabled ()
 
static void setQuitLockEnabled (bool enabled)
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 

Protected Member Functions

bool event (QEvent *) override
 \reimp
 
bool compressEvent (QEvent *, QObject *receiver, QPostEventList *) override
 
 QGuiApplication (QGuiApplicationPrivate &p)
 
- Protected Member Functions inherited from QCoreApplication
 QCoreApplication (QCoreApplicationPrivate &p)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Properties

QIcon windowIcon
 the default window icon
 
QString applicationDisplayName
 the user-visible name of this application
 
QString desktopFileName
 the base name of the desktop entry for this application
 
Qt::LayoutDirection layoutDirection
 the default layout direction for this application
 
QString platformName
 The name of the underlying platform plugin.
 
bool quitOnLastWindowClosed
 whether the application implicitly quits when the last window is closed.
 
QScreenprimaryScreen
 the primary (or default) screen of the application.
 
- Properties inherited from QCoreApplication
QString applicationName
 the name of this application
 
QString applicationVersion
 the version of this application
 
QString organizationName
 the name of the organization that wrote this application
 
QString organizationDomain
 the Internet domain of the organization that wrote this application
 
bool quitLockEnabled
 Whether the use of the QEventLoopLocker feature can cause the application to quit.
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Friends

class QFontDatabasePrivate
 
class QPlatformIntegration
 
class QPlatformSessionManager
 

Additional Inherited Members

- Public Types inherited from QCoreApplication
enum  { ApplicationFlags = QT_VERSION }
 
- Public Slots inherited from QCoreApplication
static void quit ()
 \threadsafe
 
static void exit (int retcode=0)
 Tells the application to exit with a return code.
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

\macro qGuiApp

A global pointer referring to the unique application object. Only valid for use when that object is a QGuiApplication.

See also
QCoreApplication::instance(), qApp

The QGuiApplication class manages the GUI application's control flow and main settings.

\inmodule QtGui

Since
5.0

QGuiApplication contains the main event loop, where all events from the window system and other sources are processed and dispatched. It also handles the application's initialization and finalization, and provides session management. In addition, QGuiApplication handles most of the system-wide and application-wide settings.

For any GUI application using Qt, there is precisely one QGuiApplication object no matter whether the application has 0, 1, 2 or more windows at any given time. For non-GUI Qt applications, use QCoreApplication instead, as it does not depend on the Qt GUI module. For QWidget based Qt applications, use QApplication instead, as it provides some functionality needed for creating QWidget instances.

The QGuiApplication object is accessible through the instance() function, which returns a pointer equivalent to the global \l qApp pointer.

QGuiApplication's main areas of responsibility are: \list

  • It initializes the application with the user's desktop settings, such as palette(), font() and styleHints(). It keeps track of these properties in case the user changes the desktop globally, for example, through some kind of control panel.
  • It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. You can send your own events to windows by using sendEvent() and postEvent().
  • It parses common command line arguments and sets its internal state accordingly. See the \l{QGuiApplication::QGuiApplication()} {constructor documentation} below for more details.
  • It provides localization of strings that are visible to the user via translate().
  • It provides some magical objects like the clipboard().
  • It knows about the application's windows. You can ask which window is at a certain position using topLevelAt(), get a list of topLevelWindows(), etc.
  • It provides support for sophisticated \l{Session Management} {session management}. This makes it possible for applications to terminate gracefully when the user logs out, to cancel a shutdown process if termination isn't possible and even to preserve the entire application's state for a future session. See isSessionRestored(), sessionId() and commitDataRequest() and saveStateRequest() for details. \endlist

Since the QGuiApplication object does so much initialization, it {must} be created before any other objects related to the user interface are created. QGuiApplication also deals with common command line arguments. Hence, it is usually a good idea to create it before any interpretation or modification of argv is done in the application itself.

\table \header

  • {2,1} Groups of functions

\row

\row

\row

\row

\row

\row

See also
QCoreApplication, QAbstractEventDispatcher, QEventLoop

Definition at line 36 of file qguiapplication.h.

Constructor & Destructor Documentation

◆ QGuiApplication() [1/2]

QGuiApplication::QGuiApplication ( int & argc,
char ** argv,
int = ApplicationFlags )

Initializes the window system and constructs an application object with argc command line arguments in argv.

Warning
The data referred to by argc and argv must stay valid for the entire lifetime of the QGuiApplication object. In addition, argc must be greater than zero and argv must contain at least one valid character string.

The global qApp pointer refers to this application object. Only one application object should be created.

This application object must be constructed before any \l{QPaintDevice} {paint devices} (including pixmaps, bitmaps etc.).

Note
argc and argv might be changed as Qt removes command line arguments that it recognizes.

Definition at line 637 of file qguiapplication.cpp.

References QCoreApplicationPrivate::eventDispatcher.

◆ ~QGuiApplication()

◆ QGuiApplication() [2/2]

QGuiApplication::QGuiApplication ( QGuiApplicationPrivate & p)
protected

Definition at line 649 of file qguiapplication.cpp.

Member Function Documentation

◆ allWindows()

QWindowList QGuiApplication::allWindows ( )
static

Returns a list of all the windows in the application.

The list is empty if there are no windows.

See also
topLevelWindows()

Definition at line 1012 of file qguiapplication.cpp.

References QGuiApplicationPrivate::window_list.

Referenced by StateSaver::StateSaver(), closeAllWindows(), QCocoaScreen::deliverUpdateRequests(), QWindowSystemInterface::handleScreenRemoved(), QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(), qRegisterNotificationCallbacks(), QAndroidPlatformScreen::setAvailableGeometry(), QHighDpiScaling::setGlobalFactor(), QVkKhrDisplayScreen::setVk(), QPlatformScreen::windows(), QWindowsVistaStylePrivate::winId(), and QQC2::QWindowsXPStylePrivate::winId().

+ Here is the caller graph for this function:

◆ applicationDisplayName()

static QString QGuiApplication::applicationDisplayName ( )
static

◆ applicationDisplayNameChanged

void QGuiApplication::applicationDisplayNameChanged ( )
signal

Referenced by QQuickApplication::QQuickApplication(), Q_TRACE_INSTRUMENT(), and setApplicationDisplayName().

+ Here is the caller graph for this function:

◆ applicationState()

Qt::ApplicationState QGuiApplication::applicationState ( )
static
Since
5.2

Returns the current state of the application.

You can react to application state changes to perform actions such as stopping/resuming CPU-intensive tasks, freeing/loading resources or saving/restoring application data.

Definition at line 3769 of file qguiapplication.cpp.

References QGuiApplicationPrivate::applicationState.

Referenced by QQuickApplication::active(), QCocoaWindow::createNSWindow(), QAndroidPlatformOpenGLWindow::eglSurface(), QIOSApplicationState::handleApplicationStateChanged(), QAndroidCamera::onApplicationStateChanged(), QWindowsWindow::requestActivateWindow(), QtAndroidAccessibility::runInObjectContext(), QWidgetPrivate::setFocus_sys(), QAndroidInputContext::showInputPanel(), QShortcutPrivate::simpleContextMatcher(), and QQuickApplication::state().

+ Here is the caller graph for this function:

◆ applicationStateChanged

void QGuiApplication::applicationStateChanged ( Qt::ApplicationState state)
signal
Since
5.2

This signal is emitted when the state of the application changes.

See also
applicationState()

Referenced by QAndroidCameraSession::QAndroidCameraSession(), QAndroidPlatformScreen::QAndroidPlatformScreen(), QCocoaClipboard::QCocoaClipboard(), QIOSWindow::QIOSWindow(), QQuickApplication::QQuickApplication(), QWindowsKeyMapper::QWindowsKeyMapper(), QWaylandCompositorPrivate::init(), QQuickWindowPrivate::init(), and initializeRHI().

+ Here is the caller graph for this function:

◆ changeOverrideCursor()

void QGuiApplication::changeOverrideCursor ( const QCursor & cursor)
static

Changes the currently active application override cursor to cursor.

This function has no effect if setOverrideCursor() was not called.

See also
setOverrideCursor(), overrideCursor(), restoreOverrideCursor(), QWidget::setCursor()

Definition at line 4086 of file qguiapplication.cpp.

References CHECK_QAPP_INSTANCE, cursor, qGuiApp, and setOverrideCursor().

Referenced by QWhatsThisPrivate::eventFilter(), and QBasicDrag::updateCursor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ clipboard()

◆ commitDataRequest

void QGuiApplication::commitDataRequest ( QSessionManager & manager)
signal
Since
4.2

This signal deals with \l{Session Management}{session management}. It is emitted when the QSessionManager wants the application to commit all its data.

Usually this means saving all open files, after getting permission from the user. Furthermore you may want to provide a means by which the user can cancel the shutdown.

You should not exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context.

Warning
Within this signal, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details and example usage.
Note
You should use Qt::DirectConnection when connecting to this signal.
See also
isSessionRestored(), sessionId(), saveStateRequest(), {Session Management}

Referenced by src_gui_kernel_qguiapplication::MyMainWidget::MyMainWidget().

+ Here is the caller graph for this function:

◆ compressEvent()

bool QGuiApplication::compressEvent ( QEvent * event,
QObject * receiver,
QPostEventList * postedEvents )
overrideprotectedvirtual

Reimplemented from QCoreApplication.

Definition at line 2040 of file qguiapplication.cpp.

References QCoreApplication::compressEvent().

Referenced by QApplication::compressEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ desktopFileName()

static QString QGuiApplication::desktopFileName ( )
static

◆ desktopSettingsAware()

bool QGuiApplication::desktopSettingsAware ( )
static

Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.

The default is true.

See also
setDesktopSettingsAware()

Definition at line 4257 of file qguiapplication.cpp.

References QGuiApplicationPrivate::obey_desktop_settings.

Referenced by QWidget::changeEvent(), QMacStyle::drawComplexControl(), QCommonStylePrivate::iconFromApplicationTheme(), QCommonStylePrivate::iconFromMacTheme(), QApplicationPrivate::initialize(), QQC2::QCommonStyle::pixelMetric(), QCommonStyle::pixelMetric(), qt_aqua_get_known_size(), QWindowsTheme::refreshFonts(), QMacStyle::sizeFromContents(), QQC2::QCommonStyle::standardIcon(), QQC2::QCommonStyle::standardPixmap(), QMacStyle::subControlRect(), and QGenericUnixTheme::themeNames().

+ Here is the caller graph for this function:

◆ devicePixelRatio()

qreal QGuiApplication::devicePixelRatio ( ) const

Returns the highest screen device pixel ratio found on the system.

This is the ratio between physical pixels and device-independent pixels.

Use this function only when you don't know which window you are targeting. If you do know the target window, use QWindow::devicePixelRatio() instead.

See also
QWindow::devicePixelRatio()

Definition at line 1139 of file qguiapplication.cpp.

References QScreen::devicePixelRatio, qFuzzyIsNull(), qMax(), screen, and QGuiApplicationPrivate::screen_list.

+ Here is the call graph for this function:

◆ event()

bool QGuiApplication::event ( QEvent * e)
overrideprotectedvirtual

\reimp

Reimplemented from QCoreApplication.

Definition at line 1999 of file qguiapplication.cpp.

References QEvent::ApplicationFontChange, QEvent::ApplicationPaletteChange, Qt::Desktop, QCoreApplication::event(), QEvent::ignore(), QEvent::LanguageChange, layout_direction, Qt::LayoutDirectionAuto, QCoreApplication::postEvent(), QEvent::Quit, setLayoutDirection(), topLevelWindows(), and QEvent::type().

Referenced by QApplication::event().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exec()

int QGuiApplication::exec ( )
static

Enters the main event loop and waits until exit() is called, and then returns the value that was set to exit() (which is 0 if exit() is called via quit()).

It is necessary to call this function to start event handling. The main event loop receives events from the window system and dispatches these to the application widgets.

Generally, no user interaction can take place before calling exec().

To make your application perform idle processing, e.g., executing a special function whenever there are no pending events, use a QChronoTimer with 0ns timeout. More advanced idle processing schemes can be achieved using processEvents().

We recommend that you connect clean-up code to the \l{QCoreApplication::}{aboutToQuit()} signal, instead of putting it in your application's {main()} function. This is because, on some platforms, the QApplication::exec() call may not return.

See also
quitOnLastWindowClosed, quit(), exit(), processEvents(), QCoreApplication::exec()

Definition at line 1921 of file qguiapplication.cpp.

References QCoreApplication::exec(), and qApp.

Referenced by QApplication::exec().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ focusObject()

QObject * QGuiApplication::focusObject ( )
static

Returns the QObject in currently active window that will be final receiver of events tied to focus, such as key events.

Definition at line 996 of file qguiapplication.cpp.

References focusWindow().

Referenced by QtWaylandClient::QWaylandTextInputv1::commit(), QtWaylandClient::QWaylandTextInputv2::commit(), QQuickTableViewPrivate::editFromKeyEvent(), QIBusPlatformInputContext::hidePreeditText(), QShortcutMap::keySequences(), QQuickWindowPrivate::polishItems(), querySelection(), QWindowsInputContext::reconvertString(), QWidget::setAttribute(), QWidget::setInputMethodHints(), QIBusPlatformInputContext::showPreeditText(), QWindowsInputContext::startComposition(), QtWaylandClient::QWaylandTextInputMethod::text_input_method_v1_end_input_method_event(), QtWaylandClient::QWaylandTextInputMethod::text_input_method_v1_key(), QtWaylandClient::QWaylandInputContext::update(), QtWaylandClient::QWaylandInputMethodContext::update(), QQuickDeliveryAgentPrivate::updateFocusItemTransform(), QWidget::updateMicroFocus(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv3::updateState(), QWidgetPrivate::updateWidgetTransform(), QtWaylandClient::QWaylandTextInputv1::zwp_text_input_v1_commit_string(), QtWaylandClient::QWaylandTextInputv1::zwp_text_input_v1_preedit_string(), QtWaylandClient::QWaylandTextInputv2::zwp_text_input_v2_commit_string(), QtWaylandClient::QWaylandTextInputv2::zwp_text_input_v2_preedit_string(), QtWaylandClient::QWaylandTextInputv3::zwp_text_input_v3_commit_string(), QtWaylandClient::QWaylandTextInputv3::zwp_text_input_v3_delete_surrounding_text(), QtWaylandClient::QWaylandTextInputv3::zwp_text_input_v3_done(), and QtWaylandClient::QWaylandTextInputv3::zwp_text_input_v3_preedit_string().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ focusObjectChanged

QGuiApplication::focusObjectChanged ( QObject * focusObject)
signal

This signal is emitted when final receiver of events tied to focus is changed.

focusObject is the new receiver.

See also
focusObject()

Referenced by QIOSTextInputOverlay::QIOSTextInputOverlay(), QQuickFocusFrame::QQuickFocusFrame(), QIOSMenu::dismiss(), and QIOSMenu::showPopup().

+ Here is the caller graph for this function:

◆ focusWindow()

QWindow * QGuiApplication::focusWindow ( )
static

Returns the QWindow that receives events tied to focus, such as key events.

See also
QWindow::requestActivate()

Definition at line 969 of file qguiapplication.cpp.

References QGuiApplicationPrivate::focus_window.

Referenced by QPlatformInputContext::anchorRectangle(), QPlatformInputContext::cursorRectangle(), QWindowContainer::event(), QIBusPlatformInputContext::filterEvent(), focusObject(), QXcbWindow::handleButtonPressEvent(), QAndroidInputContext::handleLocationChanged(), QWindowSystemInterface::handleShortcutEvent(), QXcbWindow::handleXEmbedMessage(), QQnxScreenEventHandler::injectKeyboardEvent(), QPlatformInputContext::inputItemClipRectangle(), QPlatformInputContext::inputItemRectangle(), QWidget::isActiveWindow(), QWindowsInputContext::isInputPanelVisible(), QPlatformInputContext::keyboardRectangle(), QShortcutMap::keySequences(), QQuickShortcutContext::matcher(), QGuiApplicationPrivate::processKeyEvent(), qQuickShortcutContextMatcher(), QPlatformInputContext::queryFocusObject(), qWidgetShortcutContextMatcher(), QtWaylandClient::QWaylandXdgSurface::requestActivate(), QQnxWindow::requestActivateWindow(), QXcbWindow::requestActivateWindow(), QEvdevTouchScreenHandlerThread::scheduleTouchPointUpdate(), QEvdevTouchScreenData::screenGeometry(), QTest::sendKeyEvent(), QWidgetPrivate::setFocus_sys(), QCocoaInputContext::setFocusObject(), QtWaylandClient::QWaylandInputContext::setFocusObject(), QtWaylandClient::QWaylandInputMethodContext::setFocusObject(), QWindowsWindow::setVisible(), QWindowsDialogHelperBase< BaseClass >::show(), QWindowsInputContext::showInputPanel(), QShortcutPrivate::simpleContextMatcher(), QWindowsInputContext::startComposition(), QWindowsMouseHandler::translateMouseEvent(), QtWaylandClient::QWaylandInputContext::update(), QtWaylandClient::QWaylandInputMethodContext::update(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv3::updateState(), windowHasFocus(), QtWaylandClient::QWaylandTextInputv1::zwp_text_input_v1_keysym(), and QtWaylandClient::QWaylandTextInputv2::zwp_text_input_v2_keysym().

+ Here is the caller graph for this function:

◆ focusWindowChanged

QGuiApplication::focusWindowChanged ( QWindow * focusWindow)
signal

This signal is emitted when the focused window changes.

focusWindow is the new focused window.

See also
focusWindow()

Referenced by QCocoaIntegration::QCocoaIntegration(), and QWasmInputContext::QWasmInputContext().

+ Here is the caller graph for this function:

◆ font()

QFont QGuiApplication::font ( )
static

Returns the default application font.

See also
setFont()

Definition at line 3545 of file qguiapplication.cpp.

References QGuiApplicationPrivate::app_font, applicationFontMutex, initFontUnlocked(), and qWarning.

Referenced by QApplication::font(), QTextItem::font(), QQuickApplication::font(), QFontDatabase::font(), QQC2::QCommonStyle::font(), QFontDatabasePrivate::load(), setFont(), and QQuickStyleItem::styleFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fontDatabaseChanged

void QGuiApplication::fontDatabaseChanged ( )
signal

This signal is emitted when the available fonts have changed.

This can happen when application fonts are added or removed, or when the system fonts change.

See also
QFontDatabase::addApplicationFont(), QFontDatabase::addApplicationFontFromData(), QFontDatabase::removeAllApplicationFonts(), QFontDatabase::removeApplicationFont()

Referenced by QFontComboBox::QFontComboBox(), and QQuickWindowPrivate::init().

+ Here is the caller graph for this function:

◆ highDpiScaleFactorRoundingPolicy()

Qt::HighDpiScaleFactorRoundingPolicy QGuiApplication::highDpiScaleFactorRoundingPolicy ( )
static
Since
5.14

Returns the high-DPI scale factor rounding policy.

Definition at line 3810 of file qguiapplication.cpp.

References QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy.

Referenced by QHighDpiScaling::roundScaleFactor().

+ Here is the caller graph for this function:

◆ inputMethod()

QInputMethod * QGuiApplication::inputMethod ( )
static

returns the input method.

The input method returns properties about the state and position of the virtual keyboard. It also provides information about the position of the current focused input element.

See also
QInputMethod

Definition at line 4271 of file qguiapplication.cpp.

References CHECK_QAPP_INSTANCE, and qGuiApp.

Referenced by QAndroidInputContext::QAndroidInputContext(), QQuickInputMethod::QQuickInputMethod(), QWindowsInputContext::QWindowsInputContext(), QPlatformInputContext::anchorRectangle(), QQuickInputMethod::anchorRectangle(), QQuickPdfSelection::clear(), QWidget::clearFocus(), QQuickDeliveryAgentPrivate::clearFocusInScope(), QQuickInputMethod::commit(), QWidgetLineControl::commitPreedit(), QWidgetTextControlPrivate::commitPreedit(), QPlatformInputContext::cursorRectangle(), QQuickInputMethod::cursorRectangle(), QQuickTextPrivate::determineHorizontalAlignment(), QQuickTextInputPrivate::determineHorizontalAlignment(), QPlatformInputContext::emitAnimatingChanged(), QPlatformInputContext::emitInputDirectionChanged(), QPlatformInputContext::emitInputPanelVisibleChanged(), QPlatformInputContext::emitKeyboardRectChanged(), QPlatformInputContext::emitLocaleChanged(), QWidgetWindow::event(), QGraphicsProxyWidget::focusInEvent(), QWidget::focusOutEvent(), QGraphicsProxyWidget::focusOutEvent(), QQuickTextEditPrivate::handleFocusEvent(), QQuickTextInputPrivate::handleFocusEvent(), QAndroidInputContext::handleLocationChanged(), QWidgetPrivate::handleSoftwareInputPanel(), QQuickInputMethod::hide(), QQuickInputMethod::inputDirection(), QPlatformInputContext::inputItemClipRectangle(), QQuickInputMethod::inputItemClipRectangle(), QPlatformInputContext::inputItemRectangle(), QQuickInputMethod::inputItemRectangle(), QQuickInputMethod::inputItemTransform(), QQuickInputMethod::invokeAction(), QQuickInputMethod::isAnimating(), QTextEngine::isRightToLeft(), QQuickInputMethod::isVisible(), QPlatformInputContext::keyboardRectangle(), QQuickInputMethod::keyboardRectangle(), QQuickTextInputPrivate::layoutDirection(), QQuickInputMethod::locale(), QWidgetTextControlPrivate::mouseMoveEvent(), QApplication::notify(), platformInputContext(), QQuickComboBoxPrivate::popupVisibleChanged(), QWidgetLineControl::processKeyEvent(), QQuickTextInputPrivate::processKeyEvent(), QPlatformInputContext::queryFocusObject(), QQuickInputMethod::reset(), QLineEditPrivate::resetInputMethod(), QQuickTextEditPrivate::resetInputMethod(), QGraphicsTextItem::sceneEvent(), QTextEdit::scrollContentsBy(), QQuickPdfSelection::selectAll(), QWidgetTextControlPrivate::sendMouseEventToInputContext(), QLineEditPrivate::sendMouseEventToInputContext(), QQuickTextInputPrivate::sendMouseEventToInputContext(), QQuickTextControlPrivate::sendMouseEventToInputContext(), QApplicationPrivate::setActiveWindow(), QWidget::setAttribute(), QWidgetPrivate::setEnabled_helper(), QWidget::setFocus(), QQuickDeliveryAgentPrivate::setFocusInScope(), QGraphicsScenePrivate::setFocusItemHelper(), QQuickInputMethod::setInputItemRectangle(), QQuickInputMethod::setInputItemTransform(), QGraphicsItem::setInputMethodHints(), QWidget::setInputMethodHints(), QPlatformInputContext::setSelectionOnFocusObject(), QWidgetLineControl::setText(), QPlainTextEditPrivate::setTopBlock(), QQuickEnterKeyAttached::setType(), QQuickInputMethod::setVisible(), QQuickInputMethod::show(), QComboBox::showPopup(), QQuickInputMethod::update(), QQuickDeliveryAgentPrivate::updateFocusItemTransform(), QWidget::updateMicroFocus(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv3::updateState(), and QWidgetPrivate::updateWidgetTransform().

◆ isLeftToRight()

bool QGuiApplication::isLeftToRight ( )
inlinestatic

Returns true if the application's layout direction is Qt::LeftToRight; otherwise returns false.

See also
layoutDirection(), isRightToLeft()

Definition at line 111 of file qguiapplication.h.

References Qt::LeftToRight.

◆ isRightToLeft()

bool QGuiApplication::isRightToLeft ( )
inlinestatic

Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false.

See also
layoutDirection(), isLeftToRight()

Definition at line 110 of file qguiapplication.h.

References Qt::RightToLeft.

Referenced by QPlainTextEdit::event(), QStyle::itemPixmapRect(), QQC2::QStyle::itemPixmapRect(), QCommonStylePrivate::rtl(), QQC2::QCommonStyle::standardIcon(), and QQC2::QCommonStyle::standardPixmap().

+ Here is the caller graph for this function:

◆ isSavingSession()

bool QGuiApplication::isSavingSession ( ) const
Since
5.0

Returns true if the application is currently saving the \l{Session Management}{session}; otherwise returns false.

This is true when commitDataRequest() and saveStateRequest() are emitted, but also when the windows are closed afterwards by session management.

See also
sessionId(), commitDataRequest(), saveStateRequest()

Definition at line 3972 of file qguiapplication.cpp.

References d.

◆ isSessionRestored()

bool QGuiApplication::isSessionRestored ( ) const

Returns true if the application has been restored from an earlier \l{Session Management}{session}; otherwise returns false.

See also
sessionId(), commitDataRequest(), saveStateRequest()

Definition at line 3954 of file qguiapplication.cpp.

References d.

◆ keyboardModifiers()

Qt::KeyboardModifiers QGuiApplication::keyboardModifiers ( )
static

Returns the current state of the modifier keys on the keyboard.

The current state is updated synchronously as the event queue is emptied of events that will spontaneously change the keyboard state (QEvent::KeyPress and QEvent::KeyRelease events).

It should be noted this may not reflect the actual keys held on the input device at the time of calling but rather the modifiers as last reported in one of the above events. If no keys are being held Qt::NoModifier is returned.

See also
mouseButtons(), queryKeyboardModifiers()

Definition at line 1825 of file qguiapplication.cpp.

References QGuiApplicationPrivate::modifier_buttons.

Referenced by QQuickDeliveryAgentPrivate::clearHover(), QApplicationPrivate::dispatchEnterLeave(), QFileDialogPrivate::enterDirectory(), QToolBar::event(), QBasicDrag::eventFilter(), QAbstractItemViewPrivate::extendedSelectionCommand(), QQuickDeliveryAgentPrivate::flushFrameSynchronousEvents(), HIDDeviceHandler::process_event(), QLibInputTouch::processTouchCancel(), QLibInputTouch::processTouchFrame(), QPlatformIntegration::queryKeyboardModifiers(), QOffscreenCursor::setPos(), QSimpleDrag::startDrag(), QXcbDrag::startDrag(), QPlainTextEdit::timerEvent(), QQuickPressHandler::timerEvent(), QApplicationPrivate::translateRawTouchEvent(), and QApplicationPrivate::translateTouchCancel().

+ Here is the caller graph for this function:

◆ lastWindowClosed

void QGuiApplication::lastWindowClosed ( )
signal

This signal is emitted from exec() when the last visible \l{Primary and Secondary Windows}{primary window} (i.e.

top level window with no transient parent) is closed.

By default, QGuiApplication quits after this signal is emitted. This feature can be turned off by setting \l quitOnLastWindowClosed to false.

See also
QWindow::close(), QWindow::isTopLevel(), QWindow::transientParent()

◆ layoutDirection()

static Qt::LayoutDirection QGuiApplication::layoutDirection ( )
static

◆ layoutDirectionChanged

void QGuiApplication::layoutDirectionChanged ( Qt::LayoutDirection direction)
signal

Referenced by QQuickApplication::QQuickApplication().

+ Here is the caller graph for this function:

◆ modalWindow()

QWindow * QGuiApplication::modalWindow ( )
static

Returns the most recently shown modal window.

If no modal windows are visible, this function returns zero.

A modal window is a window which has its \l{QWindow::modality}{modality} property set to Qt::WindowModal or Qt::ApplicationModal. A modal window must be closed before the user can continue with other parts of the program.

Modal window are organized in a stack. This function returns the modal window at the top of the stack.

See also
Qt::WindowModality, QWindow::setModality()

Definition at line 827 of file qguiapplication.cpp.

References CHECK_QAPP_INSTANCE.

Referenced by QApplication::activeModalWidget(), QAndroidPlatformWindow::blockedByModal(), QWindowPrivate::setVisible(), QXcbWindow::show(), and QWindowsContext::windowsProc().

+ Here is the caller graph for this function:

◆ mouseButtons()

Qt::MouseButtons QGuiApplication::mouseButtons ( )
static

Returns the current state of the buttons on the mouse.

The current state is updated synchronously as the event queue is emptied of events that will spontaneously change the mouse state (QEvent::MouseButtonPress and QEvent::MouseButtonRelease events).

It should be noted this may not reflect the actual buttons held on the input device at the time of calling but rather the mouse buttons as last reported in one of the above events. If no mouse buttons are being held Qt::NoButton is returned.

See also
keyboardModifiers()

Definition at line 1866 of file qguiapplication.cpp.

References QGuiApplicationPrivate::mouse_buttons.

Referenced by QToolBar::event(), QBasicDrag::eventFilter(), QWidgetResizeHandler::eventFilter(), QOffscreenCursor::setPos(), QSimpleDrag::startDrag(), and QXcbDrag::startDrag().

+ Here is the caller graph for this function:

◆ notify()

bool QGuiApplication::notify ( QObject * object,
QEvent * event )
overridevirtual

\reimp

Reimplemented from QCoreApplication.

Definition at line 1985 of file qguiapplication.cpp.

References QGuiApplicationPrivate::captureGlobalModifierState(), QCoreApplication::notify(), and QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow().

+ Here is the call graph for this function:

◆ overrideCursor()

QCursor * QGuiApplication::overrideCursor ( )
static

Returns the active application override cursor.

This function returns \nullptr if no application cursor has been defined (i.e. the internal cursor stack is empty).

See also
setOverrideCursor(), restoreOverrideCursor()

Definition at line 4072 of file qguiapplication.cpp.

References CHECK_QAPP_INSTANCE, nullptr, and qGuiApp.

Referenced by QWindowPrivate::applyCursor(), QWindowPrivate::setVisible(), and QBasicDrag::updateCursor().

+ Here is the caller graph for this function:

◆ palette()

◆ platformFunction()

QFunctionPointer QGuiApplication::platformFunction ( const QByteArray & function)
static

Returns a function pointer from the platformplugin matching function

Definition at line 1886 of file qguiapplication.cpp.

References QGuiApplicationPrivate::platformIntegration(), and qWarning.

+ Here is the call graph for this function:

◆ platformName()

static QString QGuiApplication::platformName ( )
static

◆ platformNativeInterface()

QGuiApplication::platformNativeInterface ( )
static

Returns the platform's native interface, for platform specific functionality.

Definition at line 1876 of file qguiapplication.cpp.

References QGuiApplicationPrivate::platformIntegration().

Referenced by QAndroidStyle::QAndroidStyle(), QOpenVGContext::QOpenVGContext(), QQnxWindowGrabber::QQnxWindowGrabber(), QWaylandCompositorPrivate::QWaylandCompositorPrivate(), QQC2::createTreeViewHelperWindow(), QWindowsVistaStylePrivate::hdcForWidgetBackingStore(), LibHybrisEglServerBufferIntegration::initializeHardware(), DmaBufServerBufferIntegration::initializeHardware(), DrmEglServerBufferIntegration::initializeHardware(), ShmServerBufferIntegration::initializeHardware(), VulkanServerBufferIntegration::initializeHardware(), BrcmEglIntegration::initializeHardware(), LinuxDmabufClientBufferIntegration::initializeHardware(), WaylandEglClientBufferIntegration::initializeHardware(), WaylandEglStreamClientBufferIntegration::initializeHardware(), QQC2::QWindowsStylePrivate::isDarkMode(), isInMacUnifiedToolbarArea(), locateSystemTray(), QApplication::notify(), qt_gl_resolve_extensions(), qt_macWindowMainWindow(), QQC2_NAMESPACE::qt_macWindowMainWindow(), QtWaylandClient::QWaylandWindow::sendProperty(), QtWaylandClient::QWaylandWindow::setProperty(), QXcbConnection::systemTrayTracker(), QTabBarPrivate::updateMacBorderMetrics(), and QToolBarLayout::updateMacBorderMetrics().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ primaryScreen()

static QScreen * QGuiApplication::primaryScreen ( )
static

◆ primaryScreenChanged

void QGuiApplication::primaryScreenChanged ( QScreen * screen)
signal

Referenced by QQuickApplication::QQuickApplication().

+ Here is the caller graph for this function:

◆ queryKeyboardModifiers()

Qt::KeyboardModifiers QGuiApplication::queryKeyboardModifiers ( )
static

Queries and returns the state of the modifier keys on the keyboard.

Unlike keyboardModifiers, this method returns the actual keys held on the input device at the time of calling the method.

It does not rely on the keypress events having been received by this process, which makes it possible to check the modifiers while moving a window, for instance. Note that in most cases, you should use keyboardModifiers(), which is faster and more accurate since it contains the state of the modifiers as they were when the currently processed event was received.

See also
keyboardModifiers()

Definition at line 1846 of file qguiapplication.cpp.

References CHECK_QAPP_INSTANCE, and QGuiApplicationPrivate::platformIntegration().

Referenced by QWindowsInputContext::endComposition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ quitOnLastWindowClosed()

static bool QGuiApplication::quitOnLastWindowClosed ( )
static

◆ restoreOverrideCursor()

void QGuiApplication::restoreOverrideCursor ( )
static

Undoes the last setOverrideCursor().

If setOverrideCursor() has been called twice, calling restoreOverrideCursor() will activate the first cursor set. Calling this function a second time restores the original widgets' cursors.

See also
setOverrideCursor(), overrideCursor()

Definition at line 4198 of file qguiapplication.cpp.

References applyCursor(), applyOverrideCursor(), applyWindowCursor(), QPlatformCursor::capabilities(), CHECK_QAPP_INSTANCE, clearOverrideCursor(), QPlatformCursor::OverrideCursor, qGuiApp, QGuiApplicationPrivate::screen_list, testFlag(), and QGuiApplicationPrivate::window_list.

Referenced by QWhatsThisPrivate::~QWhatsThisPrivate(), QQuickColorDialogImplPrivate::eyeDropperLeave(), releaseMouseGrabOfWidget(), QTextBrowserPrivate::setSource(), and src_gui_kernel_qguiapplication_x11::wrapper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveStateRequest

void QGuiApplication::saveStateRequest ( QSessionManager & manager)
signal
Since
4.2

This signal deals with \l{Session Management}{session management}. It is invoked when the \l{QSessionManager}{session manager} wants the application to preserve its state for a future session.

For example, a text editor would create a temporary file that includes the current contents of its edit buffers, the location of the cursor and other aspects of the current editing session.

You should never exit the application within this signal. Instead, the session manager may or may not do this afterwards, depending on the context. Furthermore, most session managers will very likely request a saved state immediately after the application has been started. This permits the session manager to learn about the application's restart policy.

Warning
Within this signal, no user interaction is possible, unless you ask the manager for explicit permission. See QSessionManager::allowsInteraction() and QSessionManager::allowsErrorInteraction() for details.
Note
You should use Qt::DirectConnection when connecting to this signal.
See also
isSessionRestored(), sessionId(), commitDataRequest(), {Session Management}

◆ screenAdded

void QGuiApplication::screenAdded ( QScreen * screen)
signal

This signal is emitted whenever a new screen screen has been added to the system.

See also
screens(), primaryScreen, screenRemoved()

Referenced by QQuickApplication::QQuickApplication().

+ Here is the caller graph for this function:

◆ screenAt()

QScreen * QGuiApplication::screenAt ( const QPoint & point)
static

Returns the screen at point, or \nullptr if outside of any screen.

The point is in relation to the virtualGeometry() of each set of virtual siblings. If the point maps to more than one set of virtual siblings the first match is returned. If you wish to search only the virtual desktop siblings of a known screen (for example siblings of the screen of your application window QWidget::windowHandle()->screen()), use QScreen::virtualSiblingAt().

Since
5.10

Definition at line 1077 of file qguiapplication.cpp.

References screen, screens(), and QScreen::virtualSiblings().

Referenced by QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QDockAreaLayout::constrainedRect(), QColorDialogPrivate::grabScreenColor(), grabScreenColor(), QPlatformWindow::initialGeometry(), QColorDialogPrivate::initWidgets(), QDockWidgetPrivate::mouseMoveEvent(), QMenuPrivate::popup(), QDateTimeEditPrivate::positionCalendarPopup(), QWhatsThisPrivate::say(), QWidget::screen(), QWidgetPrivate::setScreenForPoint(), and topLevelAt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ screenRemoved

void QGuiApplication::screenRemoved ( QScreen * screen)
signal

This signal is emitted whenever a screen is removed from the system.

It provides an opportunity to manage the windows on the screen before Qt falls back to moving them to the primary screen.

See also
screens(), screenAdded(), QObject::destroyed(), QWindow::setScreen()
Since
5.4

Referenced by QQuickApplication::QQuickApplication(), and QtWaylandClient::QWaylandSurface::QWaylandSurface().

+ Here is the caller graph for this function:

◆ screens()

◆ sessionId()

QString QGuiApplication::sessionId ( ) const

Returns the current \l{Session Management}{session's} identifier.

If the application has been restored from an earlier session, this identifier is the same as it was in that previous session. The session identifier is guaranteed to be unique both for different applications and for different instances of the same application.

See also
isSessionRestored(), sessionKey(), commitDataRequest(), saveStateRequest()

Definition at line 3960 of file qguiapplication.cpp.

References d.

◆ sessionKey()

QString QGuiApplication::sessionKey ( ) const

Returns the session key in the current \l{Session Management}{session}.

If the application has been restored from an earlier session, this key is the same as it was when the previous session ended.

The session key changes every time the session is saved. If the shutdown process is cancelled, another session key will be used when shutting down again.

See also
isSessionRestored(), sessionId(), commitDataRequest(), saveStateRequest()

Definition at line 3966 of file qguiapplication.cpp.

References d.

◆ setApplicationDisplayName()

void QGuiApplication::setApplicationDisplayName ( const QString & name)
static

Definition at line 729 of file qguiapplication.cpp.

References applicationDisplayNameChanged(), QCoreApplication::applicationName, QCoreApplication::applicationNameChanged(), disconnect(), QGuiApplicationPrivate::displayName, emit, and qGuiApp.

Referenced by QQuickApplication::setDisplayName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBadgeNumber()

void QGuiApplication::setBadgeNumber ( qint64 number)

Sets the application's badge to number.

Useful for providing feedback to the user about the number of unread messages or similar.

The badge will be overlaid on the application's icon in the Dock on \macos, the home screen icon on iOS, or the task bar on Windows and Linux.

If the number is outside the range supported by the platform, the number will be clamped to the supported range. If the number does not fit within the badge, the number may be visually elided.

Setting the number to 0 will clear the badge.

Since
6.5
See also
applicationName

Definition at line 771 of file qguiapplication.cpp.

References number, and QGuiApplicationPrivate::platformIntegration().

+ Here is the call graph for this function:

◆ setDesktopFileName()

void QGuiApplication::setDesktopFileName ( const QString & name)
static

Definition at line 792 of file qguiapplication.cpp.

References QStandardPaths::ApplicationsLocation, QGuiApplicationPrivate::desktopFileName, QString::isEmpty(), QStandardPaths::locate(), and qWarning.

+ Here is the call graph for this function:

◆ setDesktopSettingsAware()

void QGuiApplication::setDesktopSettingsAware ( bool on)
static

Sets whether Qt should use the system's standard colors, fonts, etc., to on.

By default, this is true.

This function must be called before creating the QGuiApplication object, like this:

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// ...
return app.exec();
}
See also
desktopSettingsAware()

Definition at line 4246 of file qguiapplication.cpp.

References QGuiApplicationPrivate::obey_desktop_settings.

Referenced by src_gui_kernel_qguiapplication::main().

+ Here is the caller graph for this function:

◆ setFont()

void QGuiApplication::setFont ( const QFont & font)
static

Changes the default application font to font.

See also
font()

Definition at line 3561 of file qguiapplication.cpp.

References QGuiApplicationPrivate::app_font, QEvent::ApplicationFontChange, ApplicationFontExplicitlySet, applicationFontMutex, applicationResourceFlags, emit, font(), Q_UNUSED, qGuiApp, QT_WARNING_DISABLE_DEPRECATED, QT_WARNING_POP, QT_WARNING_PUSH, and QCoreApplication::sendEvent().

Referenced by loadAndroidStyle(), and QApplication::setFont().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHighDpiScaleFactorRoundingPolicy()

void QGuiApplication::setHighDpiScaleFactorRoundingPolicy ( Qt::HighDpiScaleFactorRoundingPolicy policy)
static
Since
5.14

Sets the high-DPI scale factor rounding policy for the application. The policy decides how non-integer scale factors (such as Windows 150%) are handled.

The two principal options are whether fractional scale factors should be rounded to an integer or not. Keeping the scale factor as-is will make the user interface size match the OS setting exactly, but may cause painting errors, for example with the Windows style.

If rounding is wanted, then which type of rounding should be decided next. Mathematically correct rounding is supported but may not give the best visual results: Consider if you want to render 1.5x as 1x ("small UI") or as 2x ("large UI"). See the Qt::HighDpiScaleFactorRoundingPolicy enum for a complete list of all options.

This function must be called before creating the application object. The QGuiApplication::highDpiScaleFactorRoundingPolicy() accessor will reflect the environment, if set.

The default value is Qt::HighDpiScaleFactorRoundingPolicy::PassThrough.

Definition at line 3798 of file qguiapplication.cpp.

References QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy, policy, qApp, and qWarning.

Referenced by QHighDpiScaling::initHighDpiScaling().

+ Here is the caller graph for this function:

◆ setLayoutDirection()

void QGuiApplication::setLayoutDirection ( Qt::LayoutDirection direction)
static

Definition at line 4031 of file qguiapplication.cpp.

References direction, effective_layout_direction, emit, layout_direction, Qt::LayoutDirectionAuto, Qt::LeftToRight, qGuiApp, qt_detectRTLLanguage(), and Qt::RightToLeft.

Referenced by event(), and Q_TRACE_INSTRUMENT().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOverrideCursor()

void QGuiApplication::setOverrideCursor ( const QCursor & cursor)
static

Sets the application override cursor to cursor.

Application override cursors are intended for showing the user that the application is in a special state, for example during an operation that might take some time.

This cursor will be displayed in all the application's widgets until restoreOverrideCursor() or another setOverrideCursor() is called.

Application cursors are stored on an internal stack. setOverrideCursor() pushes the cursor onto the stack, and restoreOverrideCursor() pops the active cursor off the stack. changeOverrideCursor() changes the currently active application override cursor.

Every setOverrideCursor() must eventually be followed by a corresponding restoreOverrideCursor(), otherwise the stack will never be emptied.

Example:

See also
overrideCursor(), restoreOverrideCursor(), changeOverrideCursor(), QWidget::setCursor()

Definition at line 4177 of file qguiapplication.cpp.

References applyCursor(), applyOverrideCursor(), QPlatformCursor::capabilities(), CHECK_QAPP_INSTANCE, cursor, QPlatformCursor::OverrideCursor, qGuiApp, QGuiApplicationPrivate::screen_list, testFlag(), and QGuiApplicationPrivate::window_list.

Referenced by QWhatsThisPrivate::QWhatsThisPrivate(), changeOverrideCursor(), QQuickColorDialogImplPrivate::eyeDropperEnter(), grabMouseForWidget(), QTextBrowserPrivate::setSource(), QBasicDrag::updateCursor(), and src_gui_kernel_qguiapplication_x11::wrapper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPalette()

void QGuiApplication::setPalette ( const QPalette & pal)
static

Changes the application palette to pal.

The color roles from this palette are combined with the system's platform theme to form the application's final palette.

See also
palette()

Definition at line 3464 of file qguiapplication.cpp.

References qGuiApp, and QGuiApplicationPrivate::setPalette().

Referenced by QApplication::setPalette().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setQuitOnLastWindowClosed()

void QGuiApplication::setQuitOnLastWindowClosed ( bool quit)
static

Definition at line 3679 of file qguiapplication.cpp.

References QCoreApplication::quit(), and QGuiApplicationPrivate::quitOnLastWindowClosed.

+ Here is the call graph for this function:

◆ setWindowIcon()

◆ styleHints()

QStyleHints * QGuiApplication::styleHints ( )
static

Returns the application's style hints.

The style hints encapsulate a set of platform dependent properties such as double click intervals, full width selection and others.

The hints can be used to integrate tighter with the underlying platform.

See also
QStyleHints

Definition at line 4228 of file qguiapplication.cpp.

References QGuiApplicationPrivate::styleHints.

Referenced by QmlJSDebugger::InspectTool::InspectTool(), QQuickDrawer::QQuickDrawer(), QQuickDeliveryAgentPrivate::checkIfDoubleTapped(), QGuiApplicationPrivate::createPlatformIntegration(), QLineEdit::createStandardContextMenu(), QWidgetTextControl::createStandardContextMenu(), QQuickDeliveryAgentPrivate::dragOverThreshold(), QuickTestUtil::dragThreshold(), QQuickDrawerPrivate::grabMouse(), QQuickPathViewPrivate::handleMouseMoveEvent(), QQuickSwipeDelegatePrivate::handleMouseMoveEvent(), QQuickAbstractButtonPrivate::handleMove(), QGuiApplicationPrivate::handleThemeChanged(), QQuickTextInputPrivate::hasPendingTripleClick(), init_platform(), QtQuickControls2NativeStylePlugin::initializeEngine(), QLineEditPrivate::initMouseYThreshold(), QQuickPressHandler::mouseMoveEvent(), QQuickTextInput::mouseMoveEvent(), QComboBox::mousePressEvent(), QQuickPressHandler::mousePressEvent(), QQuickTextInput::mousePressEvent(), QQuickTextControlPrivate::mousePressEvent(), QComboBox::mouseReleaseEvent(), QQuickItemPrivate::nextPrevItemInTabFocusChain(), QWindows11Style::polish(), QWindowsVistaStyle::polish(), QQuickMouseArea::pressAndHoldInterval(), QGuiApplicationPrivate::processMouseEvent(), qt_tab_all_widgets(), QQuickStylePlugin::registerTypes(), QWidgetLineControl::resetCursorBlinkTimer(), QQuickDrawer::resetDragMargin(), QQuickTapHandler::resetLongPressThreshold(), QQuickDrag::resetThreshold(), QWidgetLineControl::setBlinkingCursorEnabled(), QApplication::setCursorFlashTime(), QWidgetTextControlPrivate::setCursorVisible(), QApplication::setDoubleClickInterval(), QQuickItemPrivate::setFocusIfNeeded(), QApplication::setKeyboardInputInterval(), QApplication::setStartDragDistance(), QApplication::setStartDragTime(), QQuickIOSCursorFlashTimer::start(), QQuickAbstractButtonPrivate::startPressAndHold(), QAbstractSpinBox::timerEvent(), QmlJSDebugger::InspectTool::touchEvent(), QQuickStylePlugin::unregisterTypes(), QWidgetLineControl::updateCursorBlinking(), QWidgetTextControlPrivate::updateCursorBlinking(), QQuickTextInputPrivate::updateCursorBlinking(), QQuickTextControlPrivate::updateCursorFlashTime(), and QQuickMultiPointTouchArea::updateTouchData().

◆ sync()

void QGuiApplication::sync ( )
static
Since
5.2

Function that can be used to sync Qt state with the Window Systems state.

This function will first empty Qts events by calling QCoreApplication::processEvents(), then the platform plugin will sync up with the windowsystem, and finally Qts events will be delived by another call to QCoreApplication::processEvents();

This function is timeconsuming and its use is discouraged.

Definition at line 4007 of file qguiapplication.cpp.

References QWindowSystemInterface::flushWindowSystemEvents(), QGuiApplicationPrivate::platform_integration, QCoreApplication::processEvents(), and QPlatformIntegration::SyncState.

+ Here is the call graph for this function:

◆ topLevelAt()

QWindow * QGuiApplication::topLevelAt ( const QPoint & pos)
static

Returns the top level window at the given position pos, if any.

Definition at line 1159 of file qguiapplication.cpp.

References pos, screenAt(), and QHighDpi::toNativePixels().

Referenced by QGuiApplicationPrivate::processMouseEvent(), QGuiApplicationPrivate::processTabletEvent(), QGuiApplicationPrivate::processTouchEvent(), QGuiApplicationPrivate::processWheelEvent(), QOffscreenWindow::setVisible(), and QApplication::topLevelAt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ topLevelWindows()

QWindowList QGuiApplication::topLevelWindows ( )
static

Returns a list of the top-level windows in the application.

See also
allWindows()

Definition at line 1024 of file qguiapplication.cpp.

References QList< T >::at(), Qt::Desktop, i, list, QList< T >::size(), topLevelWindows(), window(), and QGuiApplicationPrivate::window_list.

Referenced by QtWaylandClient::QWaylandWindow::~QWaylandWindow(), doUseNativeMenus(), event(), QOffscreenScreen::grabWindow(), QGuiApplicationPrivate::lastWindowClosed(), QGuiApplicationPrivate::notifyLayoutDirectionChange(), QApplicationPrivate::notifyLayoutDirectionChange(), QGuiApplicationPrivate::notifyWindowIconChanged(), QApplicationPrivate::notifyWindowIconChanged(), qWindowsPowerWindowProc(), QWindowsIntegration::setApplicationBadge(), QOffscreenCursor::setPos(), QPlatformScreen::topLevelAt(), topLevelAt(), topLevelWindows(), and updateWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ windowIcon()

static QIcon QGuiApplication::windowIcon ( )
static

Friends And Related Symbol Documentation

◆ QFontDatabasePrivate

friend class QFontDatabasePrivate
friend

Definition at line 179 of file qguiapplication.h.

◆ QPlatformIntegration

friend class QPlatformIntegration
friend

Definition at line 180 of file qguiapplication.h.

◆ QPlatformSessionManager

friend class QPlatformSessionManager
friend

Definition at line 182 of file qguiapplication.h.

Property Documentation

◆ applicationDisplayName

QString QGuiApplication::applicationDisplayName
readwrite

the user-visible name of this application

Since
5.0

This name is shown to the user, for instance in window titles. It can be translated, if necessary.

If not set, the application display name defaults to the application name.

See also
applicationName

Definition at line 40 of file qguiapplication.h.

Referenced by QXcbConnection::clientLeader(), and QQuickApplication::displayName().

◆ desktopFileName

QString QGuiApplication::desktopFileName
readwrite

the base name of the desktop entry for this application

Since
5.7

This is the file name, without the full path or the trailing ".desktop" extension of the desktop entry that represents this application according to the freedesktop desktop entry specification.

This property gives a precise indication of what desktop entry represents the application and it is needed by the windowing system to retrieve such information without resorting to imprecise heuristics.

The latest version of the freedesktop desktop entry specification can be obtained \l{http://standards.freedesktop.org/desktop-entry-spec/latest/}{here}.

Definition at line 42 of file qguiapplication.h.

Referenced by QXcbWindow::create().

◆ layoutDirection

◆ platformName

QString QGuiApplication::platformName
read

The name of the underlying platform plugin.

The QPA platform plugins are located in {qtbase\src \plugins\platforms}. At the time of writing, the following platform plugin names are supported:

\list

  • android
  • cocoa is a platform plugin for \macos.
  • directfb
  • eglfs is a platform plugin for running Qt5 applications on top of EGL and OpenGL ES 2.0 without an actual windowing system (like X11 or Wayland). For more information, see \l{EGLFS}.
  • ios (also used for tvOS)
  • linuxfb writes directly to the framebuffer. For more information, see \l{LinuxFB}.
  • minimal is provided as an examples for developers who want to write their own platform plugins. However, you can use the plugin to run GUI applications in environments without a GUI, such as servers.
  • minimalegl is an example plugin.
  • offscreen
  • qnx
  • windows
  • wayland is a platform plugin for the Wayland display server protocol, used on some Linux desktops and embedded systems.
  • xcb is a plugin for the X11 window system, used on some desktop Linux platforms. \endlist
Note
Calling this function without a QGuiApplication will return the default platform name, if available. The default platform name is not affected by the {-platform} command line option, or the QT_QPA_PLATFORM environment variable.

For more information about the platform plugins for embedded Linux devices, see \l{Qt for Embedded Linux}.

Definition at line 45 of file qguiapplication.h.

Referenced by DBusConnection::DBusConnection(), QGtk3Theme::QGtk3Theme(), QQmlPreviewHandler::QQmlPreviewHandler(), Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration(), QIBusPlatformInputContext::cursorRectChanged(), findBestVideoSink(), QtWayland::WindowSystemEventHandler::handleKeyEvent(), PlatformQuirks::isClipboardAvailable(), QX11Info::isPlatformX11(), QEglfsScreenCapture::isSupported(), QAbstractSpinBox::keyPressEvent(), QWidgetResizeHandler::mouseMoveEvent(), QQuickGuiProvider::pluginName(), QSGVivanteVideoNodeFactory::supportedPixelFormats(), usePlatformSizeGrip(), and QDockWidgetLayout::wmSupportsNativeWindowDeco().

◆ primaryScreen

QGuiApplication::primaryScreen
read

the primary (or default) screen of the application.

This will be the screen where QWindows are initially shown, unless otherwise specified.

The primaryScreenChanged signal was introduced in Qt 5.6.

See also
screens()

Definition at line 48 of file qguiapplication.h.

Referenced by QCGWindowCapture::Grabber::Grabber(), QOffscreenSurface::QOffscreenSurface(), QOpenGLContext::QOpenGLContext(), QQuickScreenAttached::QQuickScreenAttached(), QQuickWindowIncubationController::QQuickWindowIncubationController(), QSGAnimationDriver::QSGAnimationDriver(), QSGDefaultAnimationDriver::QSGDefaultAnimationDriver(), QVideoOutputOrientationHandler::QVideoOutputOrientationHandler(), QWhatsThat::QWhatsThat(), Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration(), QWidgetPrivate::adjustedSize(), QDialog::adjustPosition(), QX11Info::appDpiX(), QX11Info::appDpiY(), QX11Info::appRootWindow(), QX11Info::appTime(), QX11Info::appUserTime(), QXcbIntegration::beep(), QPlatformSurfaceCapture::checkScreenWithError(), QDockAreaLayout::constrainedRect(), QWindowsOleDropSource::createCursors(), QCocoaWindow::createNSWindow(), QEglFSIntegration::createPlatformWindow(), QAndroidCameraSession::currentCameraRotation(), effectiveScreen(), QDockWidget::event(), QSystemTrayIconPrivate::geometry_sys(), QX11Info::getTimestamp(), QTipLabel::getTipScreen(), QColorDialogPrivate::grabScreenColor(), grabScreenColor(), QWindowSystemInterface::handleScreenRemoved(), QTabWidget::heightForWidth(), QWindowPrivate::init(), QColormap::initialize(), QColorDialogPrivate::initWidgets(), QX11Info::isCompositingManagerRunning(), QWidgetResizeHandler::keyPressEvent(), locateSystemTray(), QPaintDeviceWindow::metric(), QOpenGLWidget::metric(), QMenuBar::minimumSizeHint(), QQC2::QWindowsStylePrivate::nativeMetricScaleFactor(), QWindowsNativeInterface::nativeResourceForCursor(), QXcbNativeInterface::nativeResourceForCursor(), operator<<(), overview_viewfinder_orientation(), QCursor::pos(), QDateTimeEditPrivate::positionCalendarPopup(), QCocoaScreen::primaryScreen(), QLibInputPointer::processAbsMotion(), QLibInputPointer::processMotion(), qsgrl_animation_interval(), qt_defaultDpiX(), qt_defaultDpiY(), QGLXContext::queryDummyContext(), QEvdevTabletData::report(), QMinimalBackingStore::resize(), QOffscreenBackingStore::resize(), QVkKhrDisplayBackingStore::resize(), QBlittablePlatformPixmap::resize(), QAlphaWidget::run(), QWhatsThisPrivate::say(), QHighDpiScaling::scaleAndOrigin(), QWidget::screen(), screenCursorSize(), screenForDeviceName(), QEvdevTouchScreenData::screenGeometry(), QQC2::screenOf(), QX11Info::setAppTime(), QX11Info::setAppUserTime(), QScrollerPrivate::setDpiFromWidget(), QLibInputPointer::setPos(), QCursor::setPos(), QOffscreenSurface::setScreen(), QOpenGLContext::setScreen(), QWizardHeader::setup(), QGraphicsView::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QTabWidget::sizeHint(), subpixelAntialiasingTypeHint(), QWaylandSurfacePrivate::surface_set_buffer_transform(), QRasterPlatformPixmap::systemNativeFormat(), QWindowsTabletSupport::translateTabletPacketEvent(), and QWindowsMouseHandler::translateTouchEvent().

◆ quitOnLastWindowClosed

bool QGuiApplication::quitOnLastWindowClosed
readwrite

whether the application implicitly quits when the last window is closed.

The default is true.

If this property is true, the application will attempt to quit when the last visible \l{Primary and Secondary Windows}{primary window} (i.e. top level window with no transient parent) is closed.

Note that attempting a quit may not necessarily result in the application quitting, for example if there still are active QEventLoopLocker instances, or the QEvent::Quit event is ignored.

See also
quit(), QWindow::close()

Definition at line 46 of file qguiapplication.h.

◆ windowIcon

QIcon QGuiApplication::windowIcon
readwrite

the default window icon

See also
QWindow::setIcon(), {Setting the Application Icon}

Definition at line 39 of file qguiapplication.h.

Referenced by QQC2::QWindowsXPStyle::drawControl(), QWindowsVistaStyle::drawControl(), QMacStyle::subElementRect(), QCommonStyle::subElementRect(), and QWidget::windowIcon().


The documentation for this class was generated from the following files: