Window QML Type
Creates a new top-level window More...
Import Statement: | import QtQuick.Window 2.2 |
Instantiates: | QQuickWindow |
Properties
- activeFocusItem : Item
- color : color
- contentOrientation : Qt::ScreenOrientation
- data : list<Object>
- flags : Qt::WindowFlags
- height : int
- maximumHeight : int
- maximumWidth : int
- minimumHeight : int
- minimumWidth : int
- modality : Qt::WindowModality
- opacity : real
- title : string
- visibility : QWindow::Visibility
- visible : bool
- width : int
- x : int
- y : int
Signals
- void closing(CloseEvent close)
Detailed Description
The Window object creates a new top-level window for a Qt Quick scene. It automatically sets up the window for use with QtQuick 2.x graphical types.
To use this type, you will need to import the module with the following line:
import QtQuick.Window 2.2
Omitting this import will allow you to have a QML environment without access to window system features.
A Window can be declared inside an Item or inside another Window; in that case the inner Window will automatically become "transient for" the outer Window: that is, most platforms will show it centered upon the outer window by default, and there may be other platform-dependent behaviors, depending also on the flags. If the nested window is intended to be a dialog in your application, you should also set flags to Qt.Dialog, because some window managers will not provide the centering behavior without that flag. You can also declare multiple windows inside a top-level QtObject, in which case the windows will have no transient relationship.
Alternatively you can set or bind x and y to position the Window explicitly on the screen.
When the user attempts to close a window, the closing signal will be emitted. You can force the window to stay open (for example to prompt the user to save changes) by writing an onClosing handler and setting close.accepted = false.
Property Documentation
activeFocusItem : Item |
The item which currently has active focus or null if there is no item with active focus.
This QML property was introduced in Qt 5.1.
color : color |
The background color for the window.
Setting this property is more efficient than using a separate Rectangle.
This is a hint to the window manager in case it needs to display additional content like popups, dialogs, status bars, or similar in relation to the window.
The recommended orientation is Screen.orientation, but an application doesn't have to support all possible orientations, and thus can opt to ignore the current screen orientation.
The difference between the window and the content orientation determines how much to rotate the content by.
The default value is Qt::PrimaryOrientation.
This QML property was introduced in Qt 5.1.
See also Screen.
The data property allows you to freely mix visual children, resources and other Windows in a Window.
If you assign another Window to the data list, the nested window will become "transient for" the outer Window.
If you assign an Item to the data list, it becomes a child of the Window's contentItem, so that it appears inside the window. The item's parent will be the window's contentItem, which is the root of the Item ownership tree within that Window.
If you assign any other object type, it is added as a resource.
It should not generally be necessary to refer to the data property, as it is the default property for Window and thus all child items are automatically assigned to this property.
See also QWindow::transientParent().
The window flags of the window.
The window flags control the window's appearance in the windowing system, whether it's a dialog, popup, or a regular window, and whether it should have a title bar, etc.
The flags which you read from this property might differ from the ones that you set if the requested flags could not be fulfilled.
Defines the window's maximum size.
This is a hint to the window manager to prevent resizing above the specified width and height.
This QML property was introduced in Qt 5.1.
Defines the window's maximum size.
This is a hint to the window manager to prevent resizing above the specified width and height.
This QML property was introduced in Qt 5.1.
Defines the window's minimum size.
This is a hint to the window manager to prevent resizing below the specified width and height.
This QML property was introduced in Qt 5.1.
Defines the window's minimum size.
This is a hint to the window manager to prevent resizing below the specified width and height.
This QML property was introduced in Qt 5.1.
The modality of the window.
A modal window prevents other windows from receiving input events. Possible values are Qt.NonModal (the default), Qt.WindowModal, and Qt.ApplicationModal.
The opacity of the window.
If the windowing system supports window opacity, this can be used to fade the window in and out, or to make it semitransparent.
A value of 1.0 or above is treated as fully opaque, whereas a value of 0.0 or below is treated as fully transparent. Values inbetween represent varying levels of translucency between the two extremes.
The default value is 1.0.
This QML property was introduced in Qt 5.1.
The window's title in the windowing system.
The window title might appear in the title area of the window decorations, depending on the windowing system and the window flags. It might also be used by the windowing system to identify the window in other contexts, such as in the task switcher.
The screen-occupation state of the window.
Visibility is whether the window should appear in the windowing system as normal, minimized, maximized, fullscreen or hidden.
To set the visibility to AutomaticVisibility means to give the window a default visible state, which might be fullscreen or windowed depending on the platform. However when reading the visibility property you will always get the actual state, never AutomaticVisibility.
When a window is not visible its visibility is Hidden, and setting visibility to Hidden is the same as setting visible to false.
This QML property was introduced in Qt 5.1.
See also visible.
Whether the window is visible on the screen.
Setting visible to false is the same as setting visibility to Hidden.
See also visibility.
Signal Documentation
void closing(CloseEvent close) |
This signal is emitted when the user tries to close the window.
This signal includes a closeEvent parameter. The close accepted property is true by default so that the window is allowed to close; but you can implement an onClosing() handler and set close.accepted = false if you need to do something else before the window can be closed.
The corresponding handler is onClosing.
This QML signal was introduced in Qt 5.1.