Application QML Type (Singleton) | Qt Quick | Qt 6.12.0
Description: Provides access to global application state properties shared by many QML components.
Keywords: qmltype

- Qt 6.12
- Qt Quick
- QML Types
- Application
- Qt 6.12.0 Reference Documentation

# Application QML Type (Singleton)

Provides access to global application state properties shared by many QML components. More...

Import Statement: | `import QtQuick`

Note: This type is a QML singleton. There is only one instance of this type in the QML engine.

- List of all members, including inherited members
- Deprecated members

## Properties

- arguments : list<string>
- displayName : string
- domain : string
- font : font
- layoutDirection : enumeration
- name : string
- organization : string
- screens : list<Screen>
- state : enumeration
- styleHints : StyleHints
- supportsMultipleWindows : bool
- version : string

## Signals

- aboutToQuit()

## 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 SystemPalette.

## Property Documentation

### arguments : list<string>

This is a string list of the arguments the executable was invoked with.

### displayName : string

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 : string

This is the organization domain set on the QCoreApplication instance. This property can be written to in order to set the organization domain.

### font : font `[read-only]`

Returns the default application font as returned by QGuiApplication::font().

### layoutDirection : enumeration `[read-only]`

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.

See the C++ Qt::LayoutDirection enum for possible values.

     RowLayout {
         layoutDirection: Application.layoutDirection
     }

### name : string

This is the application name set on the QCoreApplication instance. This property can be written to in order to set the application name.

### organization : string

This is the organization name set on the QCoreApplication instance. This property can be written to in order to set the organization name.

### screens : list<Screen> `[read-only]`

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.

### state : enumeration `[read-only]`

This property represents the current state of the application.

See the C++ Qt::ApplicationState enum for possible values.

     Timer {
         interval: 1000; repeat: true
         active: Application.state === Qt.ApplicationActive
         onTriggered: imageFetcher.fetchLatestImages()
     }

### styleHints : StyleHints `[read-only]`

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()
         }
     }

### supportsMultipleWindows : bool `[read-only]`

Returns `true` if the platform supports multiple windows. Some embedded platforms do not support multiple windows, for example.

### version : string

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.

Note: The corresponding handler is `onAboutToQuit`.

See also QCoreApplication::aboutToQuit.