Hemera::ServiceModel Class Reference

Convenience Model to access ServiceManager. More...

#include <HemeraCore/ServiceModel>

Inherits QAbstractListModel.

Public Types

enum  Roles {
  ServiceTypeRole, IdRole, NameRole, VersionRole,
  DescriptionRole, IconRole, HandledMimeTypesRole, AssociatedOrbitRole,
 Special roles exposed by this model. More...
enum  ModelDisplayType { ModelDisplayType::Applications, ModelDisplayType::OrbitalApplications, ModelDisplayType::Orbits, ModelDisplayType::AllAvailable }

Public Member Functions

 ServiceModel (ServiceManager *manager, ModelDisplayType type, QObject *parent=nullptr)
 Constructs a new ServiceModel. More...

Detailed Description

Convenience Model to access ServiceManager.

ServiceModel is a convenience model for accessing services exposed by ServiceManager in the context of a View. It is convenient for QML use cases, or simply where you want to expose Service data to a View. It abstracts ServiceInfo, and lists a specific category of Services.

A ServiceModel needs a ServiceManager to operate, which needs to be already initialized when passed. It does not take ownership of the Manager, which can be safely used outside of the context. Should the manager be deleted, every model's index will be permanently invalid. Also, it is possible to create several ServiceModel out of the same ServiceManager

See also

Member Enumeration Documentation

Special roles exposed by this model.

The list of roles exposed by this model. They're basically a mirror of ServiceInfo members.

See also

The type of the service, as in Hemera::ServiceInfo::ServiceType.


The ID of the service.


The common name of the service.


The version of the service, if any.


Human-readable description of the service, if any.


URL to the service's icon, if any.


A list of mimetypes handled by this service, if any.


The ID of the associated orbit for this service. If the service is an orbit, it is equivalent to . If the service is an application, it is equivalent to the id of the service returned by ServiceManager::orbitForApplication.

See also

A variant map of additional data carried by this service. Usually for internal use, it might carry interesting data for what concerns execution or other parameters. Usually, you shall not refer to this unless you have very specific needs.

The type of information which should be displayed by this model.

It matches the return of several ServiceManager methods when listing services.


Lists all applications on the system. Equivalent to ServiceManager::services(Application)


Lists all applications services which have a directly associated orbit - which means they can be launched with no helpers. Equivalent to ServiceManager::orbitalApplications.


Lists all orbits on the system. Equivalent to ServiceManager::services(Orbit).


Lists all available services on the system. Equivalent to ServiceManager::availableServices().

Constructor & Destructor Documentation

Hemera::ServiceModel::ServiceModel ( ServiceManager manager,
ServiceModel::ModelDisplayType  type,
QObject *  parent = nullptr 

Constructs a new ServiceModel.

A ServiceModel needs an already initialized and ready ServiceManager, which will be used as the main source for information retrieval.

A ServiceModel is valid for a single category of service types, which have to be specified upon construction. You can, however, create more than one ServiceModel out of the same ServiceManager.

Passing a non ready ServiceManager might lead to undefined behavior and crashes.
managerAn initialized and ready ServiceManager
typeThe type of services this model will expose
parentThe QObject parent for the model