Important: Please read the Qt Code of Conduct -

Unknown Object Path even after registering object in QDbus

  • I created an Interface header file and called qt5_generate_dbus_interface() from cmake to get a .xml file.
    Then I generated an adaptor from this .xml file by calling qt_add_dbus_adaptor().
    In the Interface cpp file's ctor, I binded the adaptor generated and called registerObject() and registerService() with valid arguments.
    The booleans for both returned true.
    However, I get the following error:

    Call to object / <My Service>: org.freedesktop.DBus.Error.UnknownObject (No such object path '/') failed

    Calling on the path, that I registered object at, also causes the same error.

    Some Cmake code

    set(dbus_SRCS org.kde.kdenow.Flight.xml)
     +                            org.kde.kdenow.Flight.xml
     +                            OPTIONS -M
     +                            )
     +                     ${CMAKE_CURRENT_BINARY_DIR}/org.kde.kdenow.Flight.xml
     +                     flightinterface.h
     +                     FlightInterface
     +                    )


    class FlightInterface : public QObject
            Q_CLASSINFO("D-Bus Interface", "org.kde.kdenow.Flight");
            explicit FlightInterface(QObject* parent = 0);
            void setMap(QVariantMap& map);
        public Q_SLOTS:
            QVariantMap getMap();
            QVariantMap m_map;


    FlightInterface::FlightInterface(QObject* parent): QObject(parent)
        new FlightAdaptor(this);
        QDBusConnection dbus = QDBusConnection::sessionBus();
        bool obOk = dbus.registerObject("/Flight", this);
        bool serOk= dbus.registerService("org.kde.kdenow.Flight");
        if (!obOk) {
            qDebug() << "Could not register Object";
        else {
            qDebug() << "Registered object at path";
        if (!serOk) {
            qDebug() << "Could not register service";
        else {
            qDebug() << "Registered Service";
    void FlightInterface::setMap(QVariantMap& map)
        m_map = map;
        qDebug() << m_map;
    QVariantMap FlightInterface::getMap()
        return m_map;

    I setMap() from some other valid code.

Log in to reply