ApplicationWindow QML Type | Qt Quick Controls 2 5.7

Qt 5.7 | Qt Quick Controls 2 | QML Types | ApplicationWindow QML Type

Qt 5.7.1 Reference Documentation

# ApplicationWindow QML Type

Provides a top-level application window. More...

Import Statement: | import QtQuick.Controls 2.0
Since: | Qt 5.7

- List of all members, including inherited members

## Properties

- activeFocusControl : Control
- background : Item
- contentData : list<Object>
- contentItem : Item
- font : font
- footer : Item
- header : Item
- overlay
  - overlay : Item
  - overlay.modal : Component
  - overlay.modeless : Component

## Attached Properties

- activeFocusControl : Control
- contentItem : Item
- footer : Item
- header : Item
- overlay : Item
- window : ApplicationWindow

## Detailed Description

ApplicationWindow is a Window which makes it convenient to add a header and footer item to the window.

You can declare ApplicationWindow as the root item of your application, and run it by using QQmlApplicationEngine. In this way you can control the window's properties, appearance and layout from QML.

      import QtQuick.Controls 2.0

      ApplicationWindow {
          visible: true

          header: ToolBar {
              // ...
          }

          footer: TabBar {
              // ...
          }

          StackView {
              anchors.fill: parent
          }
      }

ApplicationWindow supports popups via its overlay property, which ensures that popups are displayed above other content and that the background is dimmed when a modal popup is visible.

Note: By default, an ApplicationWindow is not visible.

See also Page and Container Controls.

## Property Documentation

[read-only] activeFocusControl : Control

This property holds the control that currently has active focus, or `null` if there is no control with active focus.

The difference between Window::activeFocusItem and ApplicationWindow::activeFocusControl is that the former may point to a building block of a control, whereas the latter points to the enclosing control. For example, when SpinBox has focus, activeFocusItem points to the editor and activeFocusControl to the SpinBox itself.

See also Window::activeFocusItem.

background : Item

This property holds the background item.

The background item is stacked under the content item, but above the background color of the window.

Note: If the background item has no explicit size specified, it automatically follows the control's size. In most cases, there is no need to specify width or height for a background item.

[default] contentData : list<Object>

This default property holds the list of all objects declared as children of the window.

See also contentItem.

[read-only] contentItem : Item

This property holds the window content item.

font : font

This property holds the font currently set for the window.

The default font depends on the system environment. QGuiApplication maintains a system/theme font which serves as a default for all application windows. You can also set the default font for windows by passing a custom font to QGuiApplication::setFont(), before loading any QML. Finally, the font is matched against Qt's font database to find the best match.

ApplicationWindow propagates explicit font properties to child controls. If you change a specific property on the window's font, that property propagates to all child controls in the window, overriding any system defaults for that property.

See also Control::font.

footer : Item

This property holds the window footer item. The footer item is positioned to the bottom, and resized to the width of the window. The default value is `null`.

Note: Assigning a ToolBar or TabBar as a window footer sets the respective ToolBar::position or TabBar::position property automatically to `Footer`.

See also header and Page::footer.

header : Item

This property holds the window header item. The header item is positioned to the top, and resized to the width of the window. The default value is `null`.

Note: Assigning a ToolBar or TabBar as a window header sets the respective ToolBar::position or TabBar::position property automatically to `Header`.

See also footer and Page::header.

overlay group
overlay : Item
overlay.modal : Component
overlay.modeless : Component

This property holds the window overlay item. Popups are automatically reparented to the overlay.

Property | Description
--- | ---
overlay.modal | This property holds a component to use as a visual item that implements background dimming for modal popups. It is created for and stacked below visible modal popups.
overlay.modeless | This property holds a component to use as a visual item that implements background dimming for modeless popups. It is created for and stacked below visible dimming popups.

See also Popup::modal and Popup::dim.

## Attached Property Documentation

[read-only] ApplicationWindow.activeFocusControl : Control

This attached property holds the control that currently has active focus, or `null` if there is no control with active focus. The property can be attached to any item. The value is `null` if the item is not in an ApplicationWindow, or the window has no active focus.

See also Window::activeFocusItem.

[read-only] ApplicationWindow.contentItem : Item

This attached property holds the window content item. The property can be attached to any item. The value is `null` if the item is not in an ApplicationWindow.

[read-only] ApplicationWindow.footer : Item

This attached property holds the window footer item. The property can be attached to any item. The value is `null` if the item is not in an ApplicationWindow, or the window has no footer item.

[read-only] ApplicationWindow.header : Item

This attached property holds the window header item. The property can be attached to any item. The value is `null` if the item is not in an ApplicationWindow, or the window has no header item.

[read-only] ApplicationWindow.overlay : Item

This attached property holds the window overlay item. The property can be attached to any item. The value is `null` if the item is not in an ApplicationWindow.

[read-only] ApplicationWindow.window : ApplicationWindow

This attached property holds the application window. The property can be attached to any item. The value is `null` if the item is not in an ApplicationWindow.