c++qtdbusqdbus

QDbus: register multiple objects on same path


If I understand, it is possible to use the registerObject method only once on the same path, even if objects have different interfaces in Q_ClassInfo.

Is this correct?


Solution

  • Yes it is correct. But if you do want to register multiple objects at the same path, you can do so by declaring those objects (say childX, childY) as children of an object, say parentObject and then calling register object as:

    registerObject(yourPath, parentObject, QDBusConnection::ExportAdaptors)
    

    This will register objects childX and childY at path yourPath

    Note: childX and childY must inherit QDBusAbstractAdaptor