QDBusAbstractAdaptor Class

The QDBusAbstractAdaptor class is the base class of D-Bus adaptor classes. 更多...

头文件: #include <QDBusAbstractAdaptor>
qmake: QT += dbus
开始支持版本: Qt 4.2
基类: QObject

公有函数

  • 32 个公有函数继承自 QObject

受保护的函数

QDBusAbstractAdaptor(QObject *obj)
bool autoRelaySignals() const
void setAutoRelaySignals(bool enable)
  • 9 个受保护的函数继承自 QObject

Macros

其他继承的成员

  • 1 个属性继承自 QObject
  • 1 个公有槽函数继承自 QObject
  • 2 个信号继承自 QObject
  • 1 个公有变量继承自 QObject
  • 10 个静态公有成员继承自 QObject
  • 2 个受保护的变量继承自 QObject

详细描述

The QDBusAbstractAdaptor class is the base class of D-Bus adaptor classes.

The QDBusAbstractAdaptor class is the starting point for all objects intending to provide interfaces to the external world using D-Bus. This is accomplished by attaching a one or more classes derived from QDBusAbstractAdaptor to a normal QObject and then registering that QObject with QDBusConnection::registerObject. QDBusAbstractAdaptor objects are intended to be light-weight wrappers, mostly just relaying calls into the real object (its parent) and the signals from it.

Each QDBusAbstractAdaptor-derived class should define the D-Bus interface it is implementing using the Q_CLASSINFO macro in the class definition. Note that only one interface can be exposed in this way.

QDBusAbstractAdaptor uses the standard QObject mechanism of signals, slots and properties to determine what signals, methods and properties to export to the bus. Any signal emitted by QDBusAbstractAdaptor-derived classes will be automatically be relayed through any D-Bus connections the object is registered on.

Classes derived from QDBusAbstractAdaptor must be created on the heap using the new operator and must not be deleted by the user (they will be deleted automatically when the object they are connected to is also deleted).

参见 Using adaptors and QDBusConnection.

成员函数

[protected] QDBusAbstractAdaptor::QDBusAbstractAdaptor(QObject *obj)

Constructs a QDBusAbstractAdaptor with obj as the parent object.

QDBusAbstractAdaptor::~QDBusAbstractAdaptor()

Destroys the adaptor.

Warning: Adaptors are destroyed automatically when the real object they refer to is destroyed. Do not delete the adaptors yourself.

[protected] bool QDBusAbstractAdaptor::autoRelaySignals() const

Returns true if automatic signal relaying from the real object (see object()) is enabled, otherwiser returns false.

参见 setAutoRelaySignals().

[protected] void QDBusAbstractAdaptor::setAutoRelaySignals(bool enable)

Toggles automatic signal relaying from the real object (see object()).

Automatic signal relaying consists of signal-to-signal connection of the signals on the parent that have the exact same method signatue in both classes.

If enable is set to true, connect the signals; if set to false, disconnect all signals.

参见 autoRelaySignals().

Q_NOREPLY

The Q_NOREPLY macro can be used to mark a method to be called and not wait for it to finish processing before returning from QDBusInterface::call(). The called method cannot return any output arguments and, if it does, any such arguments will be discarded.

You can use this macro in your own adaptors by placing it before your method's return value (which must be "void") in the class declaration, as shown in the example:


  Q_NOREPLY void myMethod();

Its presence in the method implementation (outside the class declaration) is optional.

This function was introduced in Qt 4.2.

参见 Using Qt D-Bus Adaptors.