QDBusConnectionInterface Class

The QDBusConnectionInterface class provides access to the D-Bus bus daemon service. More...

Header: #include <QDBusConnectionInterface>
qmake: QT += dbus
Since: Qt 4.2
Inherits: QDBusAbstractInterface

This class was introduced in Qt 4.2.

Public Types

enum RegisterServiceReply { ServiceNotRegistered, ServiceRegistered, ServiceQueued }
enum ServiceQueueOptions { DontQueueService, QueueService, ReplaceExistingService }
enum ServiceReplacementOptions { DontAllowReplacement, AllowReplacement }

Properties

Public Slots

QDBusReply<QStringList> activatableServiceNames() const
QDBusReply<QStringList> registeredServiceNames() const

Detailed Description

The D-Bus bus server daemon provides one special interface org.freedesktop.DBus that allows clients to access certain properties of the bus, such as the current list of clients connected. The QDBusConnectionInterface class provides access to that interface.

The most common uses of this class are to register and unregister service names on the bus using the registerService() and unregisterService() functions, query about existing names using the isServiceRegistered(), registeredServiceNames() and serviceOwner() functions, and to receive notification that a client has registered or de-registered through the serviceRegistered(), serviceUnregistered() and serviceOwnerChanged() signals.

Member Type Documentation

enum QDBusConnectionInterface::RegisterServiceReply

The possible return values from registerService():

ConstantValueDescription
QDBusConnectionInterface::ServiceNotRegistered0The call failed and the service name was not registered.
QDBusConnectionInterface::ServiceRegistered1The caller is now the owner of the service name.
QDBusConnectionInterface::ServiceQueued2The caller specified the QueueService flag and the service was already registered, so we are in queue.

The serviceRegistered() signal will be emitted when the service is acquired by this application.

enum QDBusConnectionInterface::ServiceQueueOptions

Flags for determining how a service registration should behave, in case the service name is already registered.

ConstantValueDescription
QDBusConnectionInterface::DontQueueService0If an application requests a name that is already owned, no queueing will be performed. The registeredService() call will simply fail. This is the default.
QDBusConnectionInterface::QueueService1Attempts to register the requested service, but do not try to replace it if another application already has it registered. Instead, simply put this application in queue, until it is given up. The serviceRegistered() signal will be emitted when that happens.
QDBusConnectionInterface::ReplaceExistingService2If another application already has the service name registered, attempt to replace it.

See also ServiceReplacementOptions.

enum QDBusConnectionInterface::ServiceReplacementOptions

Flags for determining if the D-Bus server should allow another application to replace a name that this application has registered with the ReplaceExistingService option.

The possible values are:

ConstantValueDescription
QDBusConnectionInterface::DontAllowReplacement0Do not allow another application to replace us. The service must be explicitly unregistered with unregisterService() for another application to acquire it. This is the default.
QDBusConnectionInterface::AllowReplacement1Allow other applications to replace us with the ReplaceExistingService option to registerService() without intervention. If that happens, the serviceUnregistered() signal will be emitted.

See also ServiceQueueOptions.

Property Documentation

activatableServiceNames : const QDBusReply<QStringList>

holds the activatable service names

Lists all names that can be activated on the bus.

This property was introduced in Qt 5.14.

Access functions:

QDBusReply<QStringList> activatableServiceNames() const

registeredServiceNames : const QDBusReply<QStringList>

holds the registered service names

Lists all names currently registered on the bus.

Access functions:

QDBusReply<QStringList> registeredServiceNames() const