Provides access to global application state properties shared by many QML components. More...
Import Statement: | import QtQuick |
The Application singleton exposes a subset of QApplication's properties to QML applications.
It also provides an aboutToQuit() signal, which is the same as QCoreApplication::aboutToQuit().
import QtQuick Window { id: root visible: true width: 800 height: 680 title: `${Application.name} (${Application.version})` Connections { target: Application function onAboutToQuit() { console.log("Bye!") } } }
See also SystemPalette.
arguments : QStringList |
This is a string list of the arguments the executable was invoked with.
displayName : QString |
This property represents the application display name set on the QGuiApplication instance. This property can be written to in order to set the application display name.
Binding { target: Application property: "displayName" value: "My Awesome Application" }
domain : QString |
This is the organization domain set on the QCoreApplication instance. This property can be written to in order to set the organization domain.
[read-only] font : QFont |
Returns the default application font as returned by QGuiApplication::font().
[read-only] layoutDirection : Qt::LayoutDirection |
This read-only property can be used to query the default layout direction of the application. On system start-up, the default layout direction depends on the application's language. The property has a value of
Qt.RightToLeft
in locales where text and graphic elements are read from right to left, and Qt.LeftToRight
where the reading direction flows from left to right. You can bind to this property to
customize your application layouts to support both layout directions.
RowLayout { layoutDirection: Application.layoutDirection }
name : QString |
This is the application name set on the QCoreApplication instance. This property can be written to in order to set the application name.
organization : QString |
This is the organization name set on the QCoreApplication instance. This property can be written to in order to set the organization name.
[read-only] screens : QQmlListProperty<QQuickScreenInfo> |
An array containing the descriptions of all connected screens. The elements of the array are objects with the same properties as the Screen attached object. In practice the array corresponds to the screen list returned by QGuiApplication::screens(). In addition to examining properties like name, width, height, etc., the array elements can also be assigned to the screen property of Window items, thus serving as an alternative to the C++ side's QWindow::setScreen().
See also Screen, Window, and Window.screen.
[read-only] state : Qt::ApplicationState |
This property represents the current state of the application.
Timer { interval: 1000; repeat: true active: Application.state === Qt.Qt.ApplicationActive onTriggered: imageFetcher.fetchLatestImages() }
[read-only] styleHints : StyleHints |
The styleHints
property provides platform-specific style hints and settings. See the QStyleHints documentation for further details.
The following example uses styleHints
to determine whether an item should gain focus on mouse press or touch release:
import QtQuick MouseArea { id: button onPressed: { if (!Application.styleHints.setFocusOnTouchRelease) button.forceActiveFocus() } onReleased: { if (Application.styleHints.setFocusOnTouchRelease) button.forceActiveFocus() } }
[read-only] supportsMultipleWindows : bool |
Returns true
if the platform supports multiple windows. Some embedded platforms do not support multiple windows, for example.
version : QString |
This is the application version set on the QCoreApplication instance. This property can be written to in order to set the application version.
aboutToQuit() |
This signal is emitted when the application is about to quit the main event loop. The signal is particularly useful if your application has to do some last-second cleanup. User interaction is not possible in this state. For more information, see Window.closing.
Note: The corresponding handler is onAboutToQuit
.
See also QCoreApplication::aboutToQuit.