Logo Search packages:      
Sourcecode: kdbus version File versions  Download package

bool QDBusConnection::connect ( QObject *  object,
const char *  slot 
)

Connects an object to receive DBus signals.

This provides a basic access to all DBus signals received on this connection. For every DBus signal processed by the connection object a Qt signal is emitted and thus delivered to all receiver objects connected through this method.

The required slot signature is

   void slotname(const QDBusMessage&);

so a suitable receiver could look like this

   class DBusSignalReceiver : public QObject
   {
       Q_OBJECT
   public slots:
       void dbusSignal(const QDBusMessage&);
   };

and would be connected like this

    // assuming the following variables
    QDBusConnection connection;
    DBusSignalReceiver* receiver;

    connection.connect(receiver, SLOT(dbusSignal(const QDBusMessage&)));

See QDBusProxy::dbusSignal() for a more obvious way of connecting slots.

Parameters:
object the receiver object
slot the receiver slot (or signal for signal->signal connections)
Returns:
true if the connection was successfull, otherwise false
See also:
disconnect()

Definition at line 302 of file qdbusconnection.cpp.

{
    if (!d || !d->connection || !object || !slot)
        return false;

    bool ok = object->connect(d, SIGNAL(dbusSignal(const QDBusMessage&)), slot);

    return ok;
}


Generated by  Doxygen 1.6.0   Back to index