Important: Please read the Qt Code of Conduct -

Is it possible to acquire multiple instances of the same remote object class

  • Hi there,

    I have a problem with aquiring multiple instances of a nested remote object class.

    Let's say I have the following rep file:

    // xyz.rep
    class Foo {
    class Bar {
      CLASS foo(Foo)

    I have now two instances of my BarSource implementation:

    class Foo: public FooSource {
    class Bar : public BarSource {
    // Somewhere else in the server
    auto* foo1 = new Foo();
    m_host->enableRemoting(foo1, foo1->objectName()); // m_host is of type QRemoteObjectHostBase*
    auto* bar1 = new Bar();
    bar1->setFoo(foo1 );
    m_host->enableRemoting(bar1, bar1->objectName());
    auto* foo2 = new Foo();
    m_host->enableRemoting(foo2, foo2->objectName());
    auto* bar2 = new Bar();
    m_host->enableRemoting(bar2, bar2->objectName());
    // Somewhere else in the client
    auto* bar1Replica = m_remoteObjectNode.acquire<Bar>("Bar1");
    auto* bar2Replica = m_remoteObjectNode.acquire<Bar>("Bar2"); // causes the assert below


    When i look at the generated header file, a hard coded string is passed when calling aquire in the generated BarReplica class:

    QRemoteObjectStringLiterals::CLASS().arg("foo") // "Class::foo"

    Am i correct in assuming that this string is causing the problem and that it cannot be dynamically customized?

Log in to reply