ServiceManager QML Type
The central instance that loads the backends and provides ServiceObjects. More...
Import Statement: | import QtInterfaceFramework |
In C++: | QIfServiceManager |
Signals
- serviceObjectLoaded(handle)
(since 6.8)
Methods
- list<ServiceObject> findServiceByInterface(interface, searchFlags, preferredBackends)
- list<ServiceObjectHandle> findServiceHandleByInterface(interface, searchFlags, preferredBackends)
(since 6.8)
- bool hasInterface(interface)
- void loadServiceObject(handle, async)
(since 6.8)
Detailed Description
The ServiceManager singleton provides a model which can be used to list all available backends and their interfaces.
This class can be useful when you want to query all available backends for a specific interface. For example, to show a list of all available backends which implement the MediaPlayer interface. The use can then be presented with an option to select between local playback, or playback using a bluetooth device.
The ServiceManager implements the QAbstractListModel interface and provides the following roles:
Role Name | Type | Description |
---|---|---|
name | string | The backend's name, such as MediaPlugin. |
serviceObject | ServiceObject | The actual QIfServiceObject, which can be used to connect a frontend API to this backend. Note: When using this role in the data() function, the backend plugin is loaded and instantiated. |
interfaces | list<string> | A list of interfaces implemented by the backend. |
For more information about QIfServiceManager and how it works, see its C++ documentation.
Signal Documentation
|
This signal is emitted when a backend identified by handle is loaded successfully or an error occurred as a result of calling loadServiceObject().
Note: The corresponding handler is onServiceObjectLoaded
.
This signal was introduced in Qt 6.8.
Method Documentation
list<ServiceObject> findServiceByInterface(interface, searchFlags, preferredBackends) |
Returns a list of backends implementing the specified interface.
The searchFlags argument can be used to control which type of backends are included in the search result:
Constant | Description |
---|---|
IncludeProductionBackends | Include production backends in the search result. See also ProductionBackend |
IncludeSimulationBackends | Include simulation backends in the search result. See also SimulationBackend |
IncludeAll | Include both production and simulation backends in the search result. |
The preferredBackends argument is used to select a backend when multiple backends implement the specified interface. The wildcards are applied in order to the found backends. If the wildcard matches some backends those backends will be loaded, otherwise the next wildcard is used.
|
Returns a list of backend handles implementing the specified interface, which can be used to load the backend asynchronously using the loadServiceObject() function.
The searchFlags argument can be used to control which type of backends are included in the search result:
Constant | Description |
---|---|
IncludeProductionBackends | Include production backends in the search result. See also ProductionBackend |
IncludeSimulationBackends | Include simulation backends in the search result. See also SimulationBackend |
IncludeAll | Include both production and simulation backends in the search result. |
The preferredBackends argument is used to select a backend when multiple backends implement the specified interface. The wildcards are applied in order to the found backends. If the wildcard matches some backends those backends will be returned, otherwise the next wildcard is used.
This method was introduced in Qt 6.8.
bool hasInterface(interface) |
Returns true
if the specified interface has been registered.
|
Loads the backend specified by the handle. If async is true
, the backend is loaded asynchronously.
Emits serviceObjectLoaded() once the backend is loaded successfully or an error occurred.
Note: The signal is always emitted, even if the backend is already loaded or could not be loaded at all.
This method was introduced in Qt 6.8.
© 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.