RemoteObject stops working after wrapping the replicanode
-
Hello
I used the simple switch remote object example with a registry from the docs.
main.cpp replica
QRemoteObjectNode repNode; repNode.setRegistryUrl(QUrl(QStringLiteral("local:registry"))); QSharedPointer<SimpleSwitchReplica> ptr; ptr.reset(repNode.acquire<SimpleSwitchReplica>()); // acquire replica of // source from host R_SimpleSwitch rSwitch(ptr);
works perfect.
After wrapping that node into my own
ROReceiver
class like this:#ifndef RORECEIVER_H #define RORECEIVER_H #include <QRemoteObjectNode> #include "r_simpleswitch.h" class ROReceiver { public: ROReceiver(QUrl registryUrl); private: QRemoteObjectNode m_repNode; }; #endif // RORECEIVER_H ROReceiver::ROReceiver(QUrl registryUrl) { m_repNode.setRegistryUrl(registryUrl); QSharedPointer<SimpleSwitchReplica> ptr; ptr.reset( m_repNode.acquire<SimpleSwitchReplica>()); // acquire replica of // source from host node R_SimpleSwitch rSwitch(ptr); }
and adjusting the main.cpp replica like followed
ROReceiver r(QUrl(QStringLiteral("local:registry")));
The example does not work anymore.
In the ctor of
ROReceiver
the replica is successfully aquired and the R_SimpleSwitch is initialized. In spite of all that theSimpleSwitchReplica::currStateChanged
event does not fire anymore, so the slot which output the replica state never executes.To me the code looks identical, except my
ROReceiver
wrapping that functionality.Any ideas?
-
Hello
I used the simple switch remote object example with a registry from the docs.
main.cpp replica
QRemoteObjectNode repNode; repNode.setRegistryUrl(QUrl(QStringLiteral("local:registry"))); QSharedPointer<SimpleSwitchReplica> ptr; ptr.reset(repNode.acquire<SimpleSwitchReplica>()); // acquire replica of // source from host R_SimpleSwitch rSwitch(ptr);
works perfect.
After wrapping that node into my own
ROReceiver
class like this:#ifndef RORECEIVER_H #define RORECEIVER_H #include <QRemoteObjectNode> #include "r_simpleswitch.h" class ROReceiver { public: ROReceiver(QUrl registryUrl); private: QRemoteObjectNode m_repNode; }; #endif // RORECEIVER_H ROReceiver::ROReceiver(QUrl registryUrl) { m_repNode.setRegistryUrl(registryUrl); QSharedPointer<SimpleSwitchReplica> ptr; ptr.reset( m_repNode.acquire<SimpleSwitchReplica>()); // acquire replica of // source from host node R_SimpleSwitch rSwitch(ptr); }
and adjusting the main.cpp replica like followed
ROReceiver r(QUrl(QStringLiteral("local:registry")));
The example does not work anymore.
In the ctor of
ROReceiver
the replica is successfully aquired and the R_SimpleSwitch is initialized. In spite of all that theSimpleSwitchReplica::currStateChanged
event does not fire anymore, so the slot which output the replica state never executes.To me the code looks identical, except my
ROReceiver
wrapping that functionality.Any ideas?
@Redman said in RemoteObject stops working after wrapping the replicanode:
ROReceiver::ROReceiver(QUrl registryUrl) {
m_repNode.setRegistryUrl(registryUrl);QSharedPointer<SimpleSwitchReplica> ptr;
ptr.reset(
m_repNode.acquire<SimpleSwitchReplica>()); // acquire replica of
// source from host nodeR_SimpleSwitch rSwitch(ptr);
}C++ basics - how long does
R_SimpleSwitch rSwitch(ptr);
live? -