Kürşat Kobya
Kürşat Kobya

Reputation: 121

How to connect QDBusConnection signal

I have connected my QDBusConnection to a slot and I am sure it is connected because connect functions return True and i can see "connected to slot" log on console.

if ( m_bus.connect("com.mypage.MyService"
        , "/MyRadio"
        , "org.freedesktop.DBus.Properties"
        , "PropertiesChanged"
        , this
        , SLOT(updateProperties(QString, QMap<QString, QVariant>))
                  )) {
        qWarning() << "connected to slot";
    }

But i cannot get any updates from corresponding dbus service. I am watching the service with dbus-monitor and am sure about signal is emitting.

the signal has following type :

      <signal name="PropertiesChanged">
          <arg type="s" name="interface_name"/>
          <arg type="a{sv}" name="changed_properties"/>
          <arg type="as" name="invalidated_properties"/>
      </signal>

If i add a third argument to Slot like QList<QString> then it cannot connect properly ("connected the slot" sentence cannot be seen).

Any clue about why this is not working properly ?

Upvotes: 0

Views: 1583

Answers (1)

K&#252;rşat Kobya
K&#252;rşat Kobya

Reputation: 121

The problem has solved after adding

qDBusRegisterMetaType<QMap<QString, QVariant>>();

So it was a simple error afterall.

Upvotes: 3

Related Questions