Chris
Chris

Reputation: 639

QDBusAbstractAdaptor vs. QDBusAbstractInterface

When exposing some code to D-Bus using Qt D-Bus bindings, when should one use a Qt Adaptor over a Qt Interface? I'm having a difficult time understanding how exactly they differ since it seems like they provide the same functionality.

Upvotes: 1

Views: 1555

Answers (2)

DBedrenko
DBedrenko

Reputation: 5039

The consumer is to use the QDBusAbstractInterface, while the producer is to use QDBusAbstractAdaptor. That is, the adaptor (producer) implements some methods, exposes some properties, and sends some signals, while the consumer calls/receives these things.

Upvotes: 2

Alex Martelli
Alex Martelli

Reputation: 882411

Per http://doc.trolltech.com/4.3/qdbusabstractinterface.html, "QDBusAbstractInterface class is the base class for all D-Bus interfaces in the QtDBus binding", while, per http://doc.trolltech.com/4.3/qdbusabstractadaptor.html, "QDBusAbstractAdaptor class is the starting point for all objects intending to provide interfaces to the external world using D-Bus". So, the former is used in the interface itself, the latter is used to provide the interface, i.e., for "exposing some code to D-Bus" you'd write a class inheriting the adaptor and "define the D-Bus interface it is implementing using the Q_CLASSINFO macro in the class definition" (also a quote from the second of the above URLs).

Upvotes: 2

Related Questions