ApplicationWindow
Public Member Functions | |
void | about () |
void | setAndroidStatusBarColor () |
Detailed Description
A window that provides some basic features needed for most applications.
This controls inherits from QQC2 Window, to checkout its inherited properties refer to the Qt Docs.
The ApplicationWindow is the best component to start creating a new MauiKit application. It's usually used as the root QML component for the application. It is different from the QQC2 alternative, as this one does not include a header or footer section, and does not have either a menu-bar. For a header and footer section use a MauiKit Page, and for the menu-bar alternative, use a MauiKit ToolButtonMenu.
- Warning
- By default the window is completely empty (and transparent since it doesn't have any container's background) - and if used with CSD (Client Side Decorations) enabled, not window controls are visible. See the example below on how to fill the application window.
Commonly, this is paired with another child container control, such as a Page, an AppViews or a SideBarView, to name a few MauiKit controls; or with any other QQC2 element, such as a StackView, SwipeView, etc..
- See also
- Page
- AppViews
- SideBarView
- TabView
- PageLayout
Client Side Decorations
- Note
- Client-side decorations refers to an application window that takes care of drawing its own window borders, shadows, and the window control buttons - and also provides the resizing and moving/dragging functionality.
The application window can make use of client side decorations (CSD) by setting the attached property Maui.CSD.enabled: true
in the root element just once, or globally by making use of MauiMan configuration options - that said, even if the system is configured to use CSD globally, you can override this property in your application, to force to use CSD (or not).
- See also
- MauiMan
- Note
- The alternative is to use the server side decorations (SSD).
When using CSD, the ApplicationWindow will take care of drawing the window borders, the shadow and masking its content to support the border rounded corners.
The radius of the corners is configured via MauiMan. To know more about how to configure it from a user level take a look at MauiMan documentation. This property can not be overridden by the application itself.
If used with a Page, you can easily enable the CSD window buttons using the attached property Maui.Controls.showCSD
, this will make the window-control-buttons visible. A few other MauiKit controls support this property, such as the TabView, ToolBar, AppViews, AltBrowser and TabView, and any other control that inherits from Page.
- See also
- Controls
If a custom control is to be used instead, and CSD is still enabled, you can place the window control buttons manually, by using the WindowControls component.
- See also
- WindowControlsLinux
Built-in Functionality
About Dialog
The Application window has some components already built-in, such as an about dialog, which can be invoked using the function about()
.
- See also
- about
The information presented in the dialog is taken from the data set with KAboutData at the application entry point. There is an example on how to set the information in the code snippet below.
Some extra information can be added via the MauiApp singleton instance, such as more links.
Toast Area - Notifications
The ApplicationWindow also includes an overlay layer for displaying inline notifications, which can be dispatched by using the function notify()
. The notifications sent can be interactive.
- See also
- notify
- Note
- If you want to use the system notifications instead, take a look at the Notify object class, and the docs on how to configure the needed steps to set it up.
- See also
- Notify
Notes
By default the window geometry is saved and restored automatically.
In order for the style and other functionality to work correctly the MauiApp
singleton instance must have been initialize before the ApplicationWindow is created. This is usually done on the main entry point of the application.
- See also
- MauiApp
It is important to notice that some of the application information needs to be provided beforehand as well, using the KAboutData
methods, this way the built-in about dialog can pick up all the relevant information.
- See also
- KAboutData
Styling
The ApplicationWindow style - as other MauiKit controls - can be tweaked, for example its color scheme: from dark to light variant, but also true-black, high-contrast, and an adaptive style which picks colors from an image source, such as a wallpaper. The available options are:
- Style.Light
- Style.Dark
- Style.Adaptive
- Style.Auto
- Style.TrueBlack
- Style.Inverted
- See also
- Style::StyleType
undefined
to rest it back to follow the global system preference from MauiMan.
The accent color can also be changed easily to distinguish the app own branding, by using the Style.accentColor
property once.
- See also
- Style::accentColor
- Warning
- When mixing Kirigami components with MauiKit controls, it is best to set the style type to the
Maui.Style.Auto
option (which value is 3), for it to correctly pick up the same color-scheme Kirigami uses - since Kirigami uses another methods for setting the color palette. The option can be set usingMaui.Style.styleType: Maui.Style.Auto
. With this set Maui will pickup the colors from the Plasma color scheme.
- See also
- Style
You can check out our quick tutorial on creating a simple Maui application here:
Minimal Example
The most basic use case is to use a Page inside of the ApplicationWindow as shown below.
You can find a more complete example at this link.
Definition at line 225 of file ApplicationWindow.qml.
Member Function Documentation
◆ about()
void ApplicationWindow::about | ( | ) |
Invokes the about dialog with information of the application.
This information is taken from KAboutData
and MauiApp
singleton instance.
- Note
- This method can be invoked for the main root ApplicationWindow using the
Maui.App.aboutDialog()
attached property method.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:47:05 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.