QDBusConnection how to handle ALL MESSAGES?

  • Hi, I've tried this one:

    class DBusListenerVirtualObject : public QDBusVirtualObject
    // QDBusVirtualObject interface
    QString introspect(const QString& path) const Q_DECL_OVERRIDE;
    bool handleMessage(const QDBusMessage& message, const QDBusConnection& connection) Q_DECL_OVERRIDE;

    QString DBusListenerVirtualObject::introspect(const QString& ) const
    return "";

    bool DBusListenerVirtualObject::handleMessage(const QDBusMessage& message, const QDBusConnection& )
    if(message.member() != "Log")
    qDebug() << message;
    return true;

    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    if(QDBusConnection::sessionBus().isConnected()) {
        QDBusConnection bus = QDBusConnection::sessionBus();
        QDBusInterface dbusInterface("org.freedesktop.DBus", "/org/freedesktop/DBus",
                                  "org.freedesktop.DBus.Monitoring", bus);
        qDebug() << "Connected to Monitoring interface";
        qDebug() << dbusInterface.call("BecomeMonitor", QStringList(), 0u);
        DBusListenerVirtualObject listener;
        qDebug() << "Object registered:" << bus.registerVirtualObject("/", &listener, QDBusConnection::SubPath);
        return a.exec();
    return 0;


    It seems that I recieve MethodCall messages, but I don't receive any signal messages, how can I handle signal messages? What have I missed? Please help me!

Log in to reply