ApplicationInterface QML Type
The main interface between apps and the application manager. More...
Import Statement: | import QtApplicationManager.Application |
Properties
- applicationId : string
- applicationProperties : var
- icon : url
- name : var
- systemProperties : var
- version : string
Signals
- memoryCriticalWarning()
- memoryLowWarning()
- openDocument(string documentUrl, string mimeType)
- quit()
Methods
- acknowledgeQuit()
- Notification createNotification()
Detailed Description
This attached type provides access to the application's metadata for QML applications. It also exposes a few global notification signals that are emitted by the application manager.
This type acts like a singleton, but in order to support the single-process use case, where multiple ApplicationInterface instances need to co-exist within the same QQmlEngine, it is implemented as an attached type that can attach to anything.
Note: Before version 6.8 the ApplicationInterface was implemented as an anonymous type via the ApplicationInterface
QML root context property. This mechanism is deprecated as it does not support modern QML tooling. The new attached type replacement does support tooling and is fully source compatible.
For other native applications, the same interface - minus the notification functionality - is available on a private peer-to-peer D-Bus interface:
For every application that is started in multi-process mode, the application manager creates a private P2P D-Bus connection and communicates the connection address to the application's process as part of the YAML snippet in the environment variable AM_CONFIG
. Only the application itself is able to connect to this P2P D-Bus - no further access policies are required on this bus.
Using this connection, you will have access to different interfaces (note that due to this not being a bus, the service name is always an empty string):
Path Name | Description |
---|---|
/ApplicationInterface io.qt.ApplicationManager.ApplicationInterface | Exactly this interface in D-Bus form. The definition is in the source distribution at src/dbus/io.qt.applicationmanager.applicationinterface.xml |
/RuntimeInterface io.qt.ApplicationManager.RuntimeInterface | The direct interface between the application manager and the launcher process, used to implement custom launchers: the definition is in the source distribution at src/dbus/io.qt.applicationmanager.runtimeinterface.xml |
If you are re-implementing the client side, note that the remote interfaces are not available immediately after connecting: they are registered on the server side only after the client connects. This is a limitation of the D-Bus design - the default implementation attempts to connect for 100ms before throwing an error.
Property Documentation
applicationId : string |
The application id of your application.
applicationProperties : var |
Returns an object with properties that have been listed under the applicationProperties
field in the manifest file (info.yaml) of the application.
icon : url |
The URL of the application's icon as given in the manifest. This can be used as the source property of an Image.
name : var |
An object containing language (string
) to application name (string
) mapppings. See name in the manifest (info.yaml) definition.
systemProperties : var |
Returns the project specific system properties that were set via the config file.
version : string |
The version of the application as specified in the manifest.
Signal Documentation
memoryCriticalWarning() |
This signal will be sent out whenever a system dependent free-memory threshold has been crossed. It is usually sent after a memoryLowWarninig
and should be perceived as a last notice to urgently free as many resources as possible to keep the system stable.
Note: The corresponding handler is onMemoryCriticalWarning
.
See also memoryLowWarning().
memoryLowWarning() |
This signal will be sent out whenever a system dependent free-memory threshold has been crossed. Your application is expected to free up as many resources as possible in this case: this will most likely involve clearing internal caches.
Note: The corresponding handler is onMemoryLowWarning
.
See also memoryCriticalWarning().
Whenever an already running application is started again with an argument, the already running instance will just receive this signal, instead of starting a separate application instance. The documentUrl parameter received by this function can either be the documentUrl
argument of ApplicationManager::startApplication, the documentUrl
field of the info.yaml manifest when calling ApplicationManager::startApplication without a documentUrl
argument or the target
argument of Qt::openUrlExternally, when your application matches a MIME-type request. In the latter case mimeType contains the MIME-type detected by the application manager.
Note: The corresponding handler is onOpenDocument
.
quit() |
The application manager will send out this signal to an application to request a controlled shutdown. The application is given a certain amount of time defined in the configuration (quitTime
). If the time elapses before acknowledgeQuit() is called, the application will simply be killed.
Note: Starting with version 6.6, acknowledgeQuit() will automatically be called if you do not connect to this signal explicitly.
Note: The corresponding handler is onQuit
.
See also acknowledgeQuit().
Method Documentation
acknowledgeQuit() |
This method should be called in response to the quit() signal, once the application is ready to be terminated (e.g. persistent data has been written).
Note: This method should be called instead of Qt.quit()
to obtain the same behavior in single- and multi-process mode (it does nothing in single process mode).
See also quit().
Notification createNotification() |
Calling this function lets you create a Notification object dynamically at runtime.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.