Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDBusConnection how to handle ALL MESSAGES?

QDBusConnection how to handle ALL MESSAGES?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 129 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MoOr
    wrote on last edited by MoOr
    #1

    Hi, I've tried this one:

    class DBusListenerVirtualObject : public QDBusVirtualObject
    {
    // QDBusVirtualObject interface
    public:
    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!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved