Important: Please read the Qt Code of Conduct -

How do you find the available methods that are offered by dbus services?

  • I'm new to Qt and dbus, and I've learned a lot. I've successfully created a program that displays the registered service names in a QPlainTextEdit's plainText property. Now, for the next step of trying to see which methods and other information (properties?) are available from the services, I'm confused. I've looked at numerous doc pages, but I cannot figure out how to do it. I can't find an example that demonstrates how to query for available public methods or properties offered by services over dbus. The bus I'm referring to is the session bus.

    If anyone can provide a small example, I would greatly appreciate it. Thanks

  • Hi, welcome to the forum.

    Every self-respecting DBus service implements org.freedesktop.DBus.Introspectable.Introspect at /org/freedesktop/DBus. You can just call that method (without any arguments) and the service will answer with a list of its public interfaces.

  • Thanks for the welcome.

    This might seem overly trivial, but I've spent several hours now just trying to figure out how to call a method :)

    I'm trying to model my code here after the example here: and what you suggested.

        QDBusConnection bus = QDBusConnection::sessionBus();
        QDBusMessage msg = QDBusMessage::createMethodCall("org.gnome.SessionManager",
        QDBusMessage reply =;
        qDebug() << reply;

    However, I get

    QDBusMessage(type=MethodReturn, service=":1.0", signature="s", contents=("<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    ") )

    in the Application Output window. Although I don't know what to expect, the scant output information leads me to believe I'm doing something wrong.

    You mentioned that I didn't need to provide any arguments, but then how would the proper service know who I'm talking to? In the example on the site I linked to, they are using three arguments out of the four. Am I doing this right? :P

  • Alright, I figured it out. I was missing the interface in the third argument.

Log in to reply