Application QML Type▲
-
Import Statement: import QtQuick
Detailed Description▲
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▲
See also SystemPalette
Property Documentation▲
[read-only] 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▲
See also Screen, Window, 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.
Signal Documentation▲
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.
The corresponding handler is onAboutToQuit.
See Also▲
See also QCoreApplication::aboutToQuit
Obsolete Members for Application▲
The following members of QML type Application are deprecated. We strongly advise against using them in new code.
Obsolete Property Documentation▲
[read-only] active : bool▲
This property is deprecated since 5.2. We strongly advise against using it in new code.
Returns whether the application is active. Use Application.state == Qt.ApplicationActive instead