![]() |
Qt 6.x
The Qt SDK
|
\macro qGuiApp More...
#include <qguiapplication.h>
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 () |
![]() | |
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 () |
![]() | |
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 |
![]() | |
QCoreApplication (int &argc, char **argv, int=ApplicationFlags) | |
Constructs a Qt core application. | |
~QCoreApplication () | |
Destroys the QCoreApplication object. | |
virtual bool | notify (QObject *, QEvent *) |
Sends event to receiver: {receiver}->event(event). | |
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. | |
![]() | |
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 | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
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< QString > | bindableObjectName () |
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). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
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::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), 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 (const QString &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 > | |
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 QObjectList & | children () 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< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () 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 QWindow * | topLevelAt (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 QWindow * | modalWindow () |
Returns the most recently shown modal window. | |
static QWindow * | focusWindow () |
Returns the QWindow that receives events tied to focus, such as key events. | |
static QObject * | focusObject () |
Returns the QObject in currently active window that will be final receiver of events tied to focus, such as key events. | |
static QScreen * | primaryScreen () |
static QList< QScreen * > | screens () |
Returns a list of all the screens associated with the windowing system the application is connected to. | |
static QScreen * | screenAt (const QPoint &point) |
Returns the screen at point, or \nullptr if outside of any screen. | |
static QCursor * | overrideCursor () |
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 QClipboard * | clipboard () |
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 QStyleHints * | styleHints () |
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 QInputMethod * | inputMethod () |
returns the input method. | |
static QPlatformNativeInterface * | platformNativeInterface () |
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 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 QCoreApplication * | instance () 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 QAbstractEventDispatcher * | eventDispatcher () |
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 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) | |
![]() | |
bool | event (QEvent *) override |
\reimp | |
virtual bool | compressEvent (QEvent *, QObject *receiver, QPostEventList *) |
QCoreApplication (QCoreApplicationPrivate &p) | |
![]() | |
QObject * | sender () 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. | |
QScreen * | primaryScreen |
the primary (or default) screen of the application. | |
![]() | |
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. | |
![]() | |
QString | objectName |
the name of this object | |
Friends | |
class | QFontDatabasePrivate |
class | QPlatformIntegration |
class | QPlatformSessionManager |
Additional Inherited Members | |
![]() | |
enum | { ApplicationFlags = QT_VERSION } |
![]() | |
static void | quit () |
\threadsafe | |
static void | exit (int retcode=0) |
Tells the application to exit with a return code. | |
![]() | |
void | deleteLater () |
\threadsafe | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
void | qAddPostRoutine (QtCleanUpFunction ptr) |
\macro Q_COREAPP_STARTUP_FUNCTION(QtStartUpFunction ptr) | |
void | qRemovePostRoutine (QtCleanUpFunction ptr) |
\threadsafe | |
void * | resolveInterface (const char *name, int revision) const |
\macro Q_DECLARE_TR_FUNCTIONS(context) | |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
\macro qGuiApp
A global pointer referring to the unique application object. Only valid for use when that object is a QGuiApplication.
The QGuiApplication class manages the GUI application's control flow and main settings.
\inmodule QtGui
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
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
\row
\row
\row
\row
\row
\row
Definition at line 36 of file qguiapplication.h.
QGuiApplication::QGuiApplication | ( | int & | argc, |
char ** | argv, | ||
int | = ApplicationFlags |
||
) |
Initializes the window system and constructs an application object with argc command line arguments in argv.
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.).
Definition at line 637 of file qguiapplication.cpp.
References QCoreApplicationPrivate::eventDispatcher, and QAbstractEventDispatcher::startingUp().
QGuiApplication::~QGuiApplication | ( | ) |
Destructs the application.
Definition at line 657 of file qguiapplication.cpp.
References QGuiApplicationPrivate::app_icon, Qt::ApplicationInactive, QGuiApplicationPrivate::applicationState, QGuiApplicationPrivate::currentDragWindow, QGuiApplicationPrivate::currentMousePressWindow, QGuiApplicationPrivate::currentMouseWindow, d, QGuiApplicationPrivate::desktopFileName, QGuiApplicationPrivate::displayName, QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy, QGuiApplicationPrivate::lastCursorPosition, QGuiApplicationPrivate::modifier_buttons, QGuiApplicationPrivate::mouse_buttons, Qt::NoButton, Qt::NoModifier, Qt::PassThrough, QGuiApplicationPrivate::platform_name, qt_call_post_routines(), QGuiApplicationPrivate::qt_clipboard, QFontDatabase::removeAllApplicationFonts(), QGuiApplicationPrivate::QLastCursorPosition::reset(), and QGuiApplicationPrivate::tabletDevicePoints.
|
protected |
Definition at line 649 of file qguiapplication.cpp.
|
static |
Returns a list of all the windows in the application.
The list is empty if there are no windows.
Definition at line 1012 of file qguiapplication.cpp.
References QGuiApplicationPrivate::window_list.
Referenced by StateSaver::StateSaver(), closeAllWindows(), QCocoaScreen::deliverUpdateRequests(), QWindowSystemInterface::handleScreenRemoved(), QWindowsWindow::moveTransientChildren(), QGuiApplicationPrivate::processScreenLogicalDotsPerInchChange(), qRegisterNotificationCallbacks(), QAndroidPlatformScreen::setAvailableGeometry(), QHighDpiScaling::setGlobalFactor(), QVkKhrDisplayScreen::setVk(), QPlatformScreen::windows(), QWindowsVistaStylePrivate::winId(), and QQC2::QWindowsXPStylePrivate::winId().
|
static |
|
signal |
Referenced by QQuickApplication::QQuickApplication(), Q_TRACE_INSTRUMENT(), and setApplicationDisplayName().
|
static |
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 3743 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(), simpleContextMatcher(), and QQuickApplication::state().
|
signal |
This signal is emitted when the state of the application changes.
Referenced by QAndroidCameraSession::QAndroidCameraSession(), QAndroidPlatformScreen::QAndroidPlatformScreen(), QCocoaClipboard::QCocoaClipboard(), QIOSWindow::QIOSWindow(), QQuickApplication::QQuickApplication(), QWindowsKeyMapper::QWindowsKeyMapper(), QWaylandCompositorPrivate::init(), and QQuickWindowPrivate::init().
Changes the currently active application override cursor to cursor.
This function has no effect if setOverrideCursor() was not called.
Definition at line 4058 of file qguiapplication.cpp.
References CHECK_QAPP_INSTANCE, cursor, qGuiApp, and setOverrideCursor().
Referenced by QWhatsThisPrivate::eventFilter(), and QBasicDrag::updateCursor().
|
static |
Returns the object for interacting with the clipboard.
Definition at line 3385 of file qguiapplication.cpp.
References qApp, QGuiApplicationPrivate::qt_clipboard, and qWarning.
Referenced by ClipWindow::ClipWindow(), QWidgetTextControlPrivate::_q_copyLink(), QWidgetTextControl::canPaste(), QQuickTextControl::canPaste(), QQuickTextInput::canPaste(), QWidgetTextControl::copy(), QWidgetLineControl::copy(), QPdfLink::copyToClipboard(), QLineEdit::createStandardContextMenu(), QPlatformClipboard::emitChanged(), QQuickTextEditPrivate::init(), QQuickTextInputPrivate::init(), PlatformQuirks::isClipboardAvailable(), QWidgetTextControlPrivate::keyPressEvent(), QMessageBox::keyPressEvent(), QAbstractItemView::keyPressEvent(), QWidgetTextControlPrivate::mouseReleaseEvent(), QLineEdit::mouseReleaseEvent(), QQuickTextInput::mouseReleaseEvent(), QQuickTextControlPrivate::mouseReleaseEvent(), droparea::DropArea::paste(), QWidgetLineControl::paste(), QWidgetTextControl::paste(), QuickTestUtil::populateClipboardText(), QWidgetLineControl::processKeyEvent(), QQuickPdfSelection::selectAll(), QWidgetTextControlPrivate::setClipboardSelection(), and src_gui_kernel_qclipboard::wrapper().
|
signal |
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.
Referenced by src_gui_kernel_qguiapplication::MyMainWidget::MyMainWidget().
|
overrideprotectedvirtual |
Reimplemented from QCoreApplication.
Definition at line 2018 of file qguiapplication.cpp.
References QCoreApplication::compressEvent().
Referenced by QApplication::compressEvent().
|
static |
|
static |
Returns true
if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false
.
The default is true
.
Definition at line 4229 of file qguiapplication.cpp.
References QGuiApplicationPrivate::obey_desktop_settings.
Referenced by QWidget::changeEvent(), QMacStyle::drawComplexControl(), QApplicationPrivate::initialize(), QQC2::QCommonStyle::pixelMetric(), QCommonStyle::pixelMetric(), qt_aqua_get_known_size(), QWindowsTheme::refreshFonts(), QMacStyle::sizeFromContents(), QQC2::QCommonStyle::standardIcon(), QCommonStyle::standardIcon(), QQC2::QCommonStyle::standardPixmap(), QCommonStyle::standardPixmap(), QMacStyle::subControlRect(), and QGenericUnixTheme::themeNames().
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.
Definition at line 1139 of file qguiapplication.cpp.
References QScreen::devicePixelRatio, qFuzzyIsNull(), qMax(), screen, and QGuiApplicationPrivate::screen_list.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QCoreApplication.
Definition at line 1982 of file qguiapplication.cpp.
References QEvent::ApplicationFontChange, QEvent::ApplicationPaletteChange, Qt::Desktop, e, QCoreApplication::event(), QEvent::LanguageChange, layout_direction, Qt::LayoutDirectionAuto, QCoreApplication::postEvent(), QEvent::Quit, setLayoutDirection(), and topLevelWindows().
Referenced by QApplication::event().
|
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 QTimer with 0 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.
Definition at line 1904 of file qguiapplication.cpp.
References QCoreApplication::exec(), and qApp.
Referenced by QApplication::exec().
|
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 QWindow::focusObject(), and 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::QWaylandTextInputv4::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::QWaylandTextInputv4::zwp_text_input_v4_commit_string(), QtWaylandClient::QWaylandTextInputv4::zwp_text_input_v4_delete_surrounding_text(), QtWaylandClient::QWaylandTextInputv4::zwp_text_input_v4_done(), and QtWaylandClient::QWaylandTextInputv4::zwp_text_input_v4_preedit_string().
|
signal |
This signal is emitted when final receiver of events tied to focus is changed.
focusObject is the new receiver.
Referenced by QIOSTextInputOverlay::QIOSTextInputOverlay(), QQuickMacFocusFrame::QQuickMacFocusFrame(), QIOSMenu::dismiss(), and QIOSMenu::showPopup().
|
static |
Returns the QWindow that receives events tied to focus, such as key events.
Definition at line 969 of file qguiapplication.cpp.
References QGuiApplicationPrivate::focus_window.
Referenced by QPlatformInputContext::anchorRectangle(), QPlatformInputContext::cursorRectangle(), 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(), simpleContextMatcher(), QWindowsInputContext::startComposition(), QWindowsMouseHandler::translateMouseEvent(), QtWaylandClient::QWaylandInputContext::update(), QtWaylandClient::QWaylandInputMethodContext::update(), QtWaylandClient::QWaylandTextInputv1::updateState(), QtWaylandClient::QWaylandTextInputv2::updateState(), QtWaylandClient::QWaylandTextInputv4::updateState(), windowHasFocus(), QtWaylandClient::QWaylandTextInputv1::zwp_text_input_v1_keysym(), and QtWaylandClient::QWaylandTextInputv2::zwp_text_input_v2_keysym().
|
signal |
This signal is emitted when the focused window changes.
focusWindow is the new focused window.
Referenced by QCocoaIntegration::QCocoaIntegration(), and QWasmInputContext::QWasmInputContext().
|
static |
Returns the default application font.
Definition at line 3529 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().
|
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.
Referenced by QQuickWindowPrivate::init().
|
static |
Returns the high-DPI scale factor rounding policy.
Definition at line 3782 of file qguiapplication.cpp.
References QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy.
Referenced by QHighDpiScaling::roundScaleFactor().
|
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.
Definition at line 4243 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::QWaylandTextInputv4::updateState(), and QWidgetPrivate::updateWidgetTransform().
|
inlinestatic |
Returns true
if the application's layout direction is Qt::LeftToRight; otherwise returns false
.
Definition at line 111 of file qguiapplication.h.
References Qt::LeftToRight.
|
inlinestatic |
Returns true
if the application's layout direction is Qt::RightToLeft; otherwise returns false
.
Definition at line 110 of file qguiapplication.h.
References Qt::RightToLeft.
Referenced by QPlainTextEdit::event(), QStyle::itemPixmapRect(), QQC2::QStyle::itemPixmapRect(), QQC2::QCommonStyle::standardIcon(), QCommonStyle::standardIcon(), QQC2::QCommonStyle::standardPixmap(), and QCommonStyle::standardPixmap().
bool QGuiApplication::isSavingSession | ( | ) | const |
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.
Definition at line 3944 of file qguiapplication.cpp.
References d.
bool QGuiApplication::isSessionRestored | ( | ) | const |
Returns true
if the application has been restored from an earlier \l{Session Management}{session}; otherwise returns false
.
Definition at line 3926 of file qguiapplication.cpp.
References d.
|
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.
Definition at line 1809 of file qguiapplication.cpp.
References QGuiApplicationPrivate::modifier_buttons.
Referenced by QFileDialogPrivate::_q_enterDirectory(), QQuickDeliveryAgentPrivate::clearHover(), QApplicationPrivate::dispatchEnterLeave(), 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().
|
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
.
|
static |
|
signal |
|
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.
Definition at line 827 of file qguiapplication.cpp.
References CHECK_QAPP_INSTANCE, QList< T >::first(), and QGuiApplicationPrivate::modalWindowList.
Referenced by QApplication::activeModalWidget(), QWindowPrivate::setVisible(), QXcbWindow::show(), and QWindowsContext::windowsProc().
|
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.
Definition at line 1850 of file qguiapplication.cpp.
References QGuiApplicationPrivate::mouse_buttons.
Referenced by QToolBar::event(), QBasicDrag::eventFilter(), QWidgetResizeHandler::eventFilter(), QOffscreenCursor::setPos(), QSimpleDrag::startDrag(), and QXcbDrag::startDrag().
\reimp
Reimplemented from QCoreApplication.
Definition at line 1968 of file qguiapplication.cpp.
References QGuiApplicationPrivate::captureGlobalModifierState(), QCoreApplication::notify(), and QGuiApplicationPrivate::sendQWindowEventToQPlatformWindow().
|
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).
Definition at line 4044 of file qguiapplication.cpp.
References CHECK_QAPP_INSTANCE, nullptr, and qGuiApp.
Referenced by QWindowPrivate::applyCursor(), QWindowPrivate::setVisible(), and QBasicDrag::updateCursor().
|
static |
Returns the current application palette.
Roles that have not been explicitly set will reflect the system's platform theme.
Definition at line 3417 of file qguiapplication.cpp.
References QGuiApplicationPrivate::app_pal, and QGuiApplicationPrivate::updatePalette().
Referenced by QQuickSystemPalette::alternateBase(), QApplicationPrivate::applyQIconStyleHelper(), QQuickSystemPalette::base(), QQuickSystemPalette::button(), QQuickSystemPalette::buttonText(), QQuickSystemPalette::dark(), QQuickWindow::event(), QWidget::event(), QQuickSystemPalette::highlight(), QQuickSystemPalette::highlightedText(), QQuickSystemPalette::light(), QQuickSystemPalette::mid(), QQuickSystemPalette::midlight(), QWidgetPrivate::naturalWidgetPalette(), QShapedPixmapWindow::paintEvent(), QApplication::palette(), PixmapEntry::pixmap(), QQuickSystemPalette::placeholderText(), QGraphicsScenePrivate::resolvePalette(), QPixmapIconEngine::scaledPixmap(), QGraphicsScene::setPalette(), QQuickSystemPalette::shadow(), standardFormat(), QQuickSystemPalette::text(), QQuickSystemPalette::window(), and QQuickSystemPalette::windowText().
|
static |
Returns a function pointer from the platformplugin matching function
Definition at line 1870 of file qguiapplication.cpp.
References function, pi, QGuiApplicationPrivate::platformIntegration(), and qWarning.
|
static |
|
static |
Returns the platform's native interface, for platform specific functionality.
Definition at line 1860 of file qguiapplication.cpp.
References pi, and 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(), qt_win_setup_PRINTDLGEX(), QtWaylandClient::QWaylandWindow::sendProperty(), QtWaylandClient::QWaylandWindow::setProperty(), QXcbConnection::systemTrayTracker(), QTabBarPrivate::updateMacBorderMetrics(), and QToolBarLayout::updateMacBorderMetrics().
|
static |
|
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.
Definition at line 1830 of file qguiapplication.cpp.
References CHECK_QAPP_INSTANCE, pi, and QGuiApplicationPrivate::platformIntegration().
Referenced by QWindowsInputContext::endComposition().
|
static |
|
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.
Definition at line 4170 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().
|
signal |
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.
This signal is emitted whenever a new screen screen has been added to the system.
Referenced by QQuickApplication::QQuickApplication().
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().
Definition at line 1077 of file qguiapplication.cpp.
References QVarLengthArray< T, Prealloc >::append(), QVarLengthArray< T, Prealloc >::contains(), 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().
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.
Referenced by QQuickApplication::QQuickApplication(), and QtWaylandClient::QWaylandSurface::QWaylandSurface().
Returns a list of all the screens associated with the windowing system the application is connected to.
Definition at line 1061 of file qguiapplication.cpp.
References QGuiApplicationPrivate::screen_list.
Referenced by QIOSIntegration::~QIOSIntegration(), QCocoaWindow::createNSWindow(), QtWaylandClient::QWaylandDisplay::ensureScreen(), findScreen(), findScreenForVirtualDesktop(), QCocoaScreen::get(), QCocoaScreen::get(), initScreensData(), qtPlatformScreenFor(), QWidget::restoreGeometry(), QWidget::saveGeometry(), screenAt(), QEglFSDeviceIntegration::screenDestroy(), QEvdevTouchScreenData::screenGeometry(), QHighDpiScaling::setGlobalFactor(), QCocoaMenu::showPopup(), QHighDpiScaling::updateHighDpiScaling(), QPlatformPlaceholderScreen::virtualSiblings(), and QCocoaScreen::virtualSiblings().
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.
Definition at line 3932 of file qguiapplication.cpp.
References d.
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.
Definition at line 3938 of file qguiapplication.cpp.
References d.
Definition at line 729 of file qguiapplication.cpp.
References applicationDisplayNameChanged(), QCoreApplication::applicationName, QCoreApplication::applicationNameChanged(), disconnect(), QGuiApplicationPrivate::displayName, emit, and qGuiApp.
Referenced by QQuickApplication::setDisplayName().
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.
Definition at line 771 of file qguiapplication.cpp.
References number, QGuiApplicationPrivate::platformIntegration(), and QPlatformIntegration::setApplicationBadge().
Definition at line 792 of file qguiapplication.cpp.
References QStandardPaths::ApplicationsLocation, QGuiApplicationPrivate::desktopFileName, QString::isEmpty(), QStandardPaths::locate(), and qWarning.
|
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:
Definition at line 4218 of file qguiapplication.cpp.
References QGuiApplicationPrivate::obey_desktop_settings.
Referenced by src_gui_kernel_qguiapplication::main().
Changes the default application font to font.
Definition at line 3545 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().
|
static |
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 3772 of file qguiapplication.cpp.
References QGuiApplicationPrivate::highDpiScaleFactorRoundingPolicy, and policy.
Referenced by QHighDpiScaling::initHighDpiScaling().
|
static |
Definition at line 4003 of file qguiapplication.cpp.
References direction, effective_layout_direction, emit, layout_direction, Qt::LayoutDirectionAuto, Qt::LeftToRight, QGuiApplicationPrivate::notifyLayoutDirectionChange(), qGuiApp, qt_detectRTLLanguage(), and Qt::RightToLeft.
Referenced by event(), and Q_TRACE_INSTRUMENT().
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:
Definition at line 4149 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().
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.
Definition at line 3449 of file qguiapplication.cpp.
References qGuiApp, and QGuiApplicationPrivate::setPalette().
Referenced by QApplication::setPalette().
|
static |
Definition at line 3659 of file qguiapplication.cpp.
References QCoreApplication::quit(), and QGuiApplicationPrivate::quitOnLastWindowClosed.
Definition at line 3622 of file qguiapplication.cpp.
References QGuiApplicationPrivate::app_icon, QPlatformIntegration::ApplicationIcon, icon, QCoreApplicationPrivate::is_app_closing, QCoreApplicationPrivate::is_app_running, QGuiApplicationPrivate::notifyWindowIconChanged(), QGuiApplicationPrivate::platform_integration, and QPlatformIntegration::setApplicationIcon().
|
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.
Definition at line 4200 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(), QQuickControlPrivate::handlePress(), QQuickControlPrivate::handleRelease(), QQuickTextInputPrivate::hasPendingTripleClick(), init_platform(), QtQuickControls2NativeStylePlugin::initializeEngine(), QLineEditPrivate::initMouseYThreshold(), QQuickPressHandler::mouseMoveEvent(), QQuickTextInput::mouseMoveEvent(), QComboBox::mousePressEvent(), QQuickPressHandler::mousePressEvent(), QQuickTextInput::mousePressEvent(), QQuickTextControlPrivate::mousePressEvent(), QComboBox::mouseReleaseEvent(), QQuickItemPrivate::nextPrevItemInTabFocusChain(), QQuickMouseArea::pressAndHoldInterval(), QGuiApplicationPrivate::processMouseEvent(), QGuiApplicationPrivate::processThemeChanged(), qt_tab_all_widgets(), QQuickStylePlugin::registerTypes(), QWidgetLineControl::resetCursorBlinkTimer(), QQuickDrawer::resetDragMargin(), QQuickDrag::resetThreshold(), QWidgetLineControl::setBlinkingCursorEnabled(), QApplication::setCursorFlashTime(), QWidgetTextControlPrivate::setCursorVisible(), QApplication::setDoubleClickInterval(), 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().
|
static |
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 3979 of file qguiapplication.cpp.
References QWindowSystemInterface::flushWindowSystemEvents(), QGuiApplicationPrivate::platform_integration, QCoreApplication::processEvents(), QPlatformIntegration::sync(), and QPlatformIntegration::SyncState.
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().
|
static |
Returns a list of the top-level windows in the application.
Definition at line 1024 of file qguiapplication.cpp.
References QList< T >::at(), Qt::Desktop, i, list, QList< T >::prepend(), 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().
|
static |
|
friend |
Definition at line 179 of file qguiapplication.h.
|
friend |
Definition at line 180 of file qguiapplication.h.
|
friend |
Definition at line 182 of file qguiapplication.h.
|
readwrite |
the user-visible name of this application
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.
Definition at line 186 of file qguiapplication.h.
Referenced by QXcbConnection::clientLeader(), and QQuickApplication::displayName().
|
readwrite |
the base name of the desktop entry for this application
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 186 of file qguiapplication.h.
|
readwrite |
the default layout direction for this application
On system start-up, or when the direction is explicitly set to Qt::LayoutDirectionAuto, the default layout direction depends on the application's language.
The notifier signal was introduced in Qt 5.4.
Definition at line 186 of file qguiapplication.h.
Referenced by QTextOption::QTextOption(), QLayout::alignmentRect(), QFormLayoutPrivate::arrangeWidgets(), QStyle::drawItemPixmap(), QQC2::QStyle::drawItemPixmap(), QBoxLayoutPrivate::effectiveMargins(), WindowCreationData::fromWindow(), QWindowsWindow::getDC(), QPainterState::init(), QQuickApplication::layoutDirection(), QGraphicsWidgetPrivate::resolveLayoutDirection(), QWidgetPrivate::resolveLayoutDirection(), QWindowsMenuItem::state(), textAlignOffset(), QWindowsPopupMenu::trackPopupMenu(), QMenuPrivate::updateLayoutDirection(), and QGraphicsLayoutPrivate::visualDirection().
|
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. \endlistFor more information about the platform plugins for embedded Linux devices, see \l{Qt for Embedded Linux}.
Definition at line 186 of file qguiapplication.h.
Referenced by QGtk3Theme::QGtk3Theme(), QQmlPreviewHandler::QQmlPreviewHandler(), Vsp2HardwareLayerIntegration::Vsp2HardwareLayerIntegration(), QIBusPlatformInputContext::cursorRectChanged(), findBestVideoSink(), QtWayland::WindowSystemEventHandler::handleKeyEvent(), PlatformQuirks::isClipboardAvailable(), QX11Info::isPlatformX11(), QAbstractSpinBox::keyPressEvent(), QWidgetResizeHandler::mouseMoveEvent(), QQuickGuiProvider::pluginName(), QSGVivanteVideoNodeFactory::supportedPixelFormats(), usePlatformSizeGrip(), and QDockWidgetLayout::wmSupportsNativeWindowDeco().
|
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.
Definition at line 186 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(), QWindowsVistaStylePrivate::openThemeForPrimaryScreenDpi(), 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(), QIOSMessageDialog::show(), QGraphicsView::sizeHint(), QMdiArea::sizeHint(), QMenuBar::sizeHint(), QTabWidget::sizeHint(), subpixelAntialiasingTypeHint(), QWaylandSurfacePrivate::surface_set_buffer_transform(), QRasterPlatformPixmap::systemNativeFormat(), QWindowsTabletSupport::translateTabletPacketEvent(), and QWindowsMouseHandler::translateTouchEvent().
|
readwrite |
whether the application implicitly quits when the last window is closed.
The default is true
.
If this property is true
, the applications quits when the last visible \l{Primary and Secondary Windows}{primary window} (i.e. top level window with no transient parent) is closed.
Definition at line 186 of file qguiapplication.h.
|
readwrite |
the default window icon
Definition at line 186 of file qguiapplication.h.
Referenced by QQC2::QWindowsXPStyle::drawControl(), QWindowsVistaStyle::drawControl(), QMacStyle::subElementRect(), QCommonStyle::subElementRect(), and QWidget::windowIcon().