#include <qdbusabstractadaptor.h>
Inheritance diagram for QDBusAbstractAdaptor:


QtDBus
Each QDBusAbstractAdaptor-derived class should define the D-Bus interface it is implementing using the Q_CLASSINFO macro in the class definition.
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).
Definition at line 34 of file qdbusabstractadaptor.h.
Public Member Functions | |
| ~QDBusAbstractAdaptor () | |
Protected Member Functions | |
| QDBusAbstractAdaptor (QObject *parent) | |
| void | setAutoRelaySignals (bool enable) |
| bool | autoRelaySignals () const |
| QDBusAbstractAdaptor::QDBusAbstractAdaptor | ( | QObject * | obj | ) | [protected] |
Constructs a QDBusAbstractAdaptor with obj as the parent object.
Definition at line 111 of file qdbusabstractadaptor.cpp.
References QCoreApplication::instance(), QMetaObject::invokeMethod(), qDBusCreateAdaptorConnector(), Qt::QueuedConnection, QObject::thread(), and QDBusAdaptorConnector::waitingForPolish.
00112 : QObject(*new QDBusAbstractAdaptorPrivate, obj) 00113 { 00114 Q_ASSERT_X(QCoreApplication::instance() == 0 || 00115 thread() == QCoreApplication::instance()->thread(), 00116 "QDBusAbstractAdaptor", "D-BUS Adaptors must be created in the main thread"); 00117 00118 QDBusAdaptorConnector *connector = qDBusCreateAdaptorConnector(obj); 00119 00120 connector->waitingForPolish = true; 00121 QMetaObject::invokeMethod(connector, "polish", Qt::QueuedConnection); 00122 }
Here is the call graph for this function:

| QDBusAbstractAdaptor::~QDBusAbstractAdaptor | ( | ) |
Destroys the adaptor.
Definition at line 130 of file qdbusabstractadaptor.cpp.
| void QDBusAbstractAdaptor::setAutoRelaySignals | ( | bool | enable | ) | [protected] |
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.
Definition at line 142 of file qdbusabstractadaptor.cpp.
References QObject::connect(), QObject::disconnect(), QMetaObject::indexOfSignal(), QMetaObject::method(), QMetaObject::methodCount(), QMetaObject::normalizedSignature(), QObject::parent(), QByteArray::prepend(), QSIGNAL_CODE, and QMetaMethod::Signal.
00143 { 00144 const QMetaObject *us = metaObject(); 00145 const QMetaObject *them = parent()->metaObject(); 00146 bool connected = false; 00147 for (int idx = staticMetaObject.methodCount(); idx < us->methodCount(); ++idx) { 00148 QMetaMethod mm = us->method(idx); 00149 00150 if (mm.methodType() != QMetaMethod::Signal) 00151 continue; 00152 00153 // try to connect/disconnect to a signal on the parent that has the same method signature 00154 QByteArray sig = QMetaObject::normalizedSignature(mm.signature()); 00155 if (them->indexOfSignal(sig) == -1) 00156 continue; 00157 sig.prepend(QSIGNAL_CODE + '0'); 00158 parent()->disconnect(sig, this, sig); 00159 if (enable) 00160 connected = connect(parent(), sig, sig) || connected; 00161 } 00162 d_func()->autoRelaySignals = connected; 00163 }
Here is the call graph for this function:

| bool QDBusAbstractAdaptor::autoRelaySignals | ( | ) | const [protected] |
Returns true if automatic signal relaying from the real object (see object()) is enabled, otherwiser returns false.
Definition at line 171 of file qdbusabstractadaptor.cpp.
1.5.1