QDBusInterface Class
The QDBusInterface class is a proxy for interfaces on remote objects. More…
| Header | #include <QDBusInterface> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::DBus) |
| Module | Nt D-Bus C++ Classes |
| Inherits | QDBusAbstractInterface |
List of all members, including inherited members
Public Functions
| QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(), const QDBusConnection &connection = QDBusConnection::sessionBus(), QObject *parent = nullptr) | |
| ~QDBusInterface() |
Detailed Description
QDBusInterface calls methods of a remote object by name, without a class written for the interface:
QDBusInterface clock("org.example.Clock", "/clock", "org.example.Clock");
QDBusReply<QString> now = clock.call("Now");
clock.setProperty("Volume", 7);
When it is constructed, QDBusInterface asks the remote object for its introspection data. The arguments of call() and the values of setProperty() are then converted to the types the interface declares, so that clock.call("SetAlarm", 7) sends a uint if the method takes one.
See also QDBusAbstractInterface and QDBusConnection::connect().
Differences from Qt
QDBusInterface has no meta-object built from the introspection data, so its methods, signals and properties are not visible to QMetaObject and QObject::connect() with SIGNAL() cannot reach the remote signals; connect to them with QDBusConnection::connect(). property() and setProperty() work as in QDBusAbstractInterface.
Member Function Documentation
QDBusInterface::QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(), const QDBusConnection &connection = QDBusConnection::sessionBus(), QObject *parent = nullptr)
Constructs an interface to interface of the object at path in service, reached through connection, with the given parent. If interface is empty, calls carry no interface and the members of all interfaces of the object are known.
QDBusInterface::~QDBusInterface()
Destroys the interface.