Is it possible to acquire multiple instances of the same remote object class
Unsolved
General and Desktop
-
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 { Q_OBJECT ... }; class Bar : public BarSource { Q_OBJECT ... }; // Somewhere else in the server auto* foo1 = new Foo(); foo1->setObjectName("Foo1"); m_host->enableRemoting(foo1, foo1->objectName()); // m_host is of type QRemoteObjectHostBase* auto* bar1 = new Bar(); bar1->setObjectName("Bar1"); bar1->setFoo(foo1 ); m_host->enableRemoting(bar1, bar1->objectName()); auto* foo2 = new Foo(); foo2->setObjectName("Foo2"); m_host->enableRemoting(foo2, foo2->objectName()); auto* bar2 = new Bar(); bar2->setObjectName("Bar2"); bar2->setFoo(foo2); 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?