diff options
Diffstat (limited to 'src/remoteobjects/doc/snippets/doc_src_simpleswitch.cpp')
-rw-r--r-- | src/remoteobjects/doc/snippets/doc_src_simpleswitch.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/remoteobjects/doc/snippets/doc_src_simpleswitch.cpp b/src/remoteobjects/doc/snippets/doc_src_simpleswitch.cpp index 5711c02..9257489 100644 --- a/src/remoteobjects/doc/snippets/doc_src_simpleswitch.cpp +++ b/src/remoteobjects/doc/snippets/doc_src_simpleswitch.cpp @@ -111,7 +111,7 @@ void SimpleSwitch::timeout_slot() //! [simpleSwitch_serversource_example1] //! [simpleSwitch_serverhostnode_example1] -QRemoteObjectHost srcNode; +QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:switch"))); //! [simpleSwitch_serverhostnode_example1] //! [simpleSwitch_enableremoting_example1] @@ -129,9 +129,7 @@ int main(int argc, char *argv[]) SimpleSwitch srcSwitch; // create simple switch - QRemoteObjectHost srcNode; // create host node without Registry - //The static node creation routines take one or two URLs as input parameters, but they have default values to help people getting started. - //It is recommended use your own URLs in any production environment to avoid name conflicts. + QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:switch")); // create host node without Registry srcNode.enableRemoting(&srcSwitch); // enable remoting/sharing return a.exec(); @@ -144,7 +142,7 @@ REPC_REPLICA = simpleswitch.rep //! [simpleSwitch_clientremotenode_example1] QRemoteObjectNode repNode; // create remote object node -repNode.connect(); // connect with remote host node +repNode.connectToNode(QUrl(QStringLiteral("local:switch")); // connect with remote host node //! [simpleSwitch_clientremotenode_example1] //! [simpleSwitch_clientacquirereplica_example1] @@ -230,7 +228,7 @@ int main(int argc, char *argv[]) QSharedPointer<SimpleSwitchReplica> ptr; // shared pointer to hold source replica QRemoteObjectNode repNode; // create remote object node - repNode.connect(); // connect with remote host node + repNode.connectToNode(QUrl(QStringLiteral("local:switch")); // connect with remote host node ptr.reset(repNode.acquire<SimpleSwitchReplica>()); // acquire replica of source from host node @@ -242,7 +240,7 @@ int main(int argc, char *argv[]) //! [simpleSwitch_dynamicclientnode_example2] QRemoteObjectNode repNode; // create remote object node -repNode.connect(); // connect with remote host node +repNode.connectToNode(QUrl(QStringLiteral("local:switch")); // connect with remote host node //! [simpleSwitch_dynamicclientnode_example2] //! [simpleSwitch_dynamicclientacquirereplica_example2] @@ -329,7 +327,8 @@ int main(int argc, char *argv[]) QSharedPointer<QRemoteObjectDynamicReplica> ptr; // shared pointer to hold replica - QRemoteObjectNode repNode(QUrl(QStringLiteral("local:registry"))); + QRemoteObjectNode repNode; + repNode.connectToNode(QUrl(QStringLiteral("local:switch")); ptr.reset(repNode.acquireDynamic("SimpleSwitch")); // acquire replica of source from host node @@ -348,7 +347,7 @@ int main(int argc, char *argv[]) SimpleSwitch srcSwitch; // create SimpleSwitch QRemoteObjectRegistryHost regNode(QUrl(QStringLiteral("local:registry"))); // create node that hosts registry - QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:switch")), QUrl(QStringLiteral("local:registry"))); // create node that will host source and connect to registry + QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:switch")), QUrl(QStringLiteral("local:registry"))); // create node that will host source and connect to registry //Note, you can add srcSwitch directly to regNode if desired. //We use two Nodes here, as the regNode could easily be in a third process. |