Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > c61c536f80c3d067f7ca643389c560f9 > files > 28

qtremoteobjects5-doc-5.12.2-2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qremoteobjectnode.cpp -->
  <title>QRemoteObjectHostBase Class | Qt Remote Objects 5.12.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.12</td><td ><a href="qtremoteobjects-index.html">Qt Remote Objects</a></td><td ><a href="qtremoteobjects-module.html">C++ Classes</a></td><td >QRemoteObjectHostBase</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtremoteobjects-index.html">Qt 5.12.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QRemoteObjectHostBase Class</h1>
<!-- $$$QRemoteObjectHostBase-brief -->
<p>The <a href="qremoteobjecthostbase.html">QRemoteObjectHostBase</a> class provides base functionality common to <a href="qremoteobjecthost.html">Host</a> and <a href="qremoteobjectregistryhost.html">RegistryHost</a> classes. <a href="#details">More...</a></p>
<!-- @@@QRemoteObjectHostBase -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QRemoteObjectHostBase&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += remoteobjects</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qremoteobjectnode.html">QRemoteObjectNode</a></td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherited By:</td><td class="memItemRight bottomAlign"> <p><a href="qremoteobjecthost.html">QRemoteObjectHost</a> and <a href="qremoteobjectregistryhost.html">QRemoteObjectRegistryHost</a></p>
</td></tr></table></div><ul>
<li><a href="qremoteobjecthostbase-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#AllowedSchemas-enum">AllowedSchemas</a></b> { BuiltInSchemasOnly, AllowExternalRegistration }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#RemoteObjectNameFilter-typedef">RemoteObjectNameFilter</a></b></td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#dtor.QRemoteObjectHostBase">~QRemoteObjectHostBase</a></b>() override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#addHostSideConnection">addHostSideConnection</a></b>(QIODevice *<i>ioDevice</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#disableRemoting">disableRemoting</a></b>(QObject *<i>remoteObject</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a></b>(ObjectType *<i>object</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#enableRemoting-1">enableRemoting</a></b>(QObject *<i>object</i>, const QString &amp;<i>name</i> = QString())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#enableRemoting-2">enableRemoting</a></b>(QAbstractItemModel *<i>model</i>, const QString &amp;<i>name</i>, const QVector&lt;int&gt; <i>roles</i>, QItemSelectionModel *<i>selectionModel</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#proxy">proxy</a></b>(const QUrl &amp;<i>registryUrl</i>, const QUrl &amp;<i>hostUrl</i> = {}, QRemoteObjectHostBase::RemoteObjectNameFilter <i>filter</i> = [](const QString &amp;, const QString &amp;) {return true; })</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#reverseProxy">reverseProxy</a></b>(QRemoteObjectHostBase::RemoteObjectNameFilter <i>filter</i> = [](const QString &amp;, const QString &amp;) {return true; })</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#setName">setName</a></b>(const QString &amp;<i>name</i>) override</td></tr>
</table></div>
<ul>
<li class="fn">18 public functions inherited from <a href="qremoteobjectnode.html#public-functions">QRemoteObjectNode</a></li>
</ul>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qremoteobjecthostbase.html#staticMetaObject-var">staticMetaObject</a></b></td></tr>
</table></div>
<h3>Additional Inherited Members</h3>
<ul>
<li class="fn">3 properties inherited from <a href="qremoteobjectnode.html#properties">QRemoteObjectNode</a></li>
<li class="fn">4 signals inherited from <a href="qremoteobjectnode.html#signals">QRemoteObjectNode</a></li>
<li class="fn">1 protected function inherited from <a href="qremoteobjectnode.html#protected-functions">QRemoteObjectNode</a></li>
</ul>
<a name="details"></a>
<!-- $$$QRemoteObjectHostBase-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qremoteobjecthostbase.html">QRemoteObjectHostBase</a> class provides base functionality common to <a href="qremoteobjecthost.html">Host</a> and <a href="qremoteobjectregistryhost.html">RegistryHost</a> classes.</p>
<p><a href="qremoteobjecthostbase.html">QRemoteObjectHostBase</a> is a base class that cannot be instantiated directly. It provides the <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a> and <a href="qremoteobjecthostbase.html#disableRemoting">disableRemoting</a> functionality shared by all host nodes (<a href="qremoteobjecthost.html">Host</a> and <a href="qremoteobjectregistryhost.html">RegistryHost</a>) as well as the logic required to expose <a href="qtremoteobjects-source.html#source">Source</a> objects on the Remote Objects network.</p>
</div>
<!-- @@@QRemoteObjectHostBase -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$AllowedSchemas$$$BuiltInSchemasOnly$$$AllowExternalRegistration -->
<h3 class="fn" id="AllowedSchemas-enum"><a name="AllowedSchemas-enum"></a>enum QRemoteObjectHostBase::<span class="name">AllowedSchemas</span></h3>
<p>This enum is used to specify whether a Node will accept a url with an unrecognized schema for the hostUrl. By default only urls with known schemas are accepted, but using <code>AllowExternalRegistration</code> will enable the <a href="qtremoteobjects-registry.html#registry">Registry</a> to pass your external (to QtRO) url to client Nodes.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QRemoteObjectHostBase::BuiltInSchemasOnly</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Only allow the hostUrl to be set to a QtRO supported schema. This is the default value, and causes a Node error to be set if an unrecognized schema is provided.</td></tr>
<tr><td class="topAlign"><code>QRemoteObjectHostBase::AllowExternalRegistration</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The provided schema is registered as an <a href="qtremoteobjects-external-schemas.html#external-schemas">External Schema</a></td></tr>
</table></div>
<p><b>See also </b><a href="qremoteobjecthost.html">QRemoteObjectHost</a>.</p>
<!-- @@@AllowedSchemas -->
<!-- $$$RemoteObjectNameFilter -->
<h3 class="fn" id="RemoteObjectNameFilter-typedef"><a name="RemoteObjectNameFilter-typedef"></a>typedef QRemoteObjectHostBase::<span class="name">RemoteObjectNameFilter</span></h3>
<!-- @@@RemoteObjectNameFilter -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$~QRemoteObjectHostBase[overload1]$$$~QRemoteObjectHostBase -->
<h3 class="fn" id="dtor.QRemoteObjectHostBase"><a name="dtor.QRemoteObjectHostBase"></a><code>[override virtual] </code>QRemoteObjectHostBase::<span class="name">~QRemoteObjectHostBase</span>()</h3>
<p>Destroys the instance of QRemoteObjectHostBase. The destructor is virtual.</p><!-- @@@~QRemoteObjectHostBase -->
<!-- $$$addHostSideConnection[overload1]$$$addHostSideConnectionQIODevice* -->
<h3 class="fn" id="addHostSideConnection"><a name="addHostSideConnection"></a><span class="type">void</span> QRemoteObjectHostBase::<span class="name">addHostSideConnection</span>(<span class="type">QIODevice</span> *<i>ioDevice</i>)</h3>
<p>In order to <a href="qremoteobjecthostbase.html#enableRemoting">QRemoteObjectHost::enableRemoting</a>() <a href="qtremoteobjects-source.html#source">Source</a> objects over <a href="qtremoteobjects-external-schemas.html#external-qiodevices">External QIODevices</a>, Qt Remote Objects needs access to the communications channel (a QIODevice) between the respective nodes. It is the addHostSideConnection() call that enables this on the <a href="qtremoteobjects-source.html#source">Source</a> side, taking the <i>ioDevice</i> as input. Any <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a>() call will still work without calling addHostSideConnection, but the Node will not be able to share the <a href="qtremoteobjects-source.html#source">Source</a> objects without being provided the connection to the Replica node. Before calling this function you must call <a href="qremoteobjecthost.html#setHostUrl">setHostUrl</a>() with a unique URL and <a href="qremoteobjecthostbase.html#AllowedSchemas-enum">AllowExternalRegistration</a>.</p>
<p>This function was introduced in  Qt 5.12.</p>
<p><b>See also </b><a href="qremoteobjectnode.html#addClientSideConnection">addClientSideConnection</a>.</p>
<!-- @@@addHostSideConnection -->
<!-- $$$disableRemoting[overload1]$$$disableRemotingQObject* -->
<h3 class="fn" id="disableRemoting"><a name="disableRemoting"></a><span class="type">bool</span> QRemoteObjectHostBase::<span class="name">disableRemoting</span>(<span class="type">QObject</span> *<i>remoteObject</i>)</h3>
<p>Disables remote access for the QObject <i>remoteObject</i>. Returns <code>false</code> if the current node is a client node or if the <i>remoteObject</i> is not registered, and returns <code>true</code> if remoting is successfully disabled for the Source object.</p>
<p><b>Warning:</b> Replicas of this object will no longer be valid after calling this method.</p>
<p><b>See also </b><a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a>().</p>
<!-- @@@disableRemoting -->
<!-- $$$enableRemoting[overload1]$$$enableRemotingObjectType* -->
<h3 class="fn" id="enableRemoting"><a name="enableRemoting"></a><span class="type">bool</span> QRemoteObjectHostBase::<span class="name">enableRemoting</span>(<span class="type">ObjectType</span> *<i>object</i>)</h3>
<!-- @@@enableRemoting -->
<!-- $$$enableRemoting$$$enableRemotingQObject*constQString& -->
<h3 class="fn" id="enableRemoting-1"><a name="enableRemoting-1"></a><span class="type">bool</span> QRemoteObjectHostBase::<span class="name">enableRemoting</span>(<span class="type">QObject</span> *<i>object</i>, const <span class="type">QString</span> &amp;<i>name</i> = QString())</h3>
<p>Enables a host node to dynamically provide remote access to the QObject <i>object</i>. Client nodes connected to the node hosting this object may obtain Replicas of this Source.</p>
<p>The <i>name</i> defines the lookup-name under which the QObject can be acquired using <a href="qremoteobjectnode.html#acquire">QRemoteObjectNode::acquire</a>() . If not explicitly set then the name given in the QCLASSINFO_REMOTEOBJECT_TYPE will be used. If no such macro was defined for the QObject then the QObject::objectName() is used.</p>
<p>Returns <code>false</code> if the current node is a client node, or if the QObject is already registered to be remoted, and <code>true</code> if remoting is successfully enabled for the dynamic QObject.</p>
<p><b>See also </b><a href="qremoteobjecthostbase.html#disableRemoting">disableRemoting</a>().</p>
<!-- @@@enableRemoting -->
<!-- $$$enableRemoting$$$enableRemotingQAbstractItemModel*constQString&constQVector<int>QItemSelectionModel* -->
<h3 class="fn" id="enableRemoting-2"><a name="enableRemoting-2"></a><span class="type">bool</span> QRemoteObjectHostBase::<span class="name">enableRemoting</span>(<span class="type">QAbstractItemModel</span> *<i>model</i>, const <span class="type">QString</span> &amp;<i>name</i>, const <span class="type">QVector</span>&lt;<span class="type">int</span>&gt; <i>roles</i>, <span class="type">QItemSelectionModel</span> *<i>selectionModel</i> = nullptr)</h3>
<p>This overload of <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a>() is specific to QAbstractItemModel types (or any type derived from QAbstractItemModel). This is useful if you want to have a model and the HMI for the model in different processes.</p>
<p>The three required parameters are the <i>model</i> itself, the <i>name</i> by which to lookup the model, and the <i>roles</i> that should be exposed on the Replica side. If you want to synchronize selection between <a href="qtremoteobjects-source.html#source">Source</a> and <a href="qtremoteobjects-replica.html#replica">Replica</a>, the optional <i>selectionModel</i> parameter can be used. This is only recommended when using a single Replica.</p>
<p>Behind the scenes, Qt Remote Objects batches data() lookups and prefetches data when possible to make the model interaction as responsive as possible.</p>
<p>Returns <code>false</code> if the current node is a client node, or if the QObject is already registered to be remoted, and <code>true</code> if remoting is successfully enabled for the QAbstractItemModel.</p>
<p><b>See also </b><a href="qremoteobjecthostbase.html#disableRemoting">disableRemoting</a>().</p>
<!-- @@@enableRemoting -->
<!-- $$$proxy[overload1]$$$proxyconstQUrl&constQUrl&QRemoteObjectHostBase::RemoteObjectNameFilter -->
<h3 class="fn" id="proxy"><a name="proxy"></a><span class="type">bool</span> QRemoteObjectHostBase::<span class="name">proxy</span>(const <span class="type">QUrl</span> &amp;<i>registryUrl</i>, const <span class="type">QUrl</span> &amp;<i>hostUrl</i> = {}, <span class="type"><a href="qremoteobjecthostbase.html#RemoteObjectNameFilter-typedef">QRemoteObjectHostBase::RemoteObjectNameFilter</a></span> <i>filter</i> = [](const QString &amp;, const QString &amp;) {return true; })</h3>
<p>Forward Remote Objects from another network</p>
<p>The proxy functionality is useful when you want to share <a href="qtremoteobjects-source.html#source">Source</a> objects over multiple networks. For instance, if you have an embedded target using target-only connections (like local) and you want to make some of those same objects available externally.</p>
<p>As a concrete example, say you have a set of processes talking to each other on your target hardware using a registry, with the <a href="qtremoteobjects-registry.html#registry">Registry</a> at &quot;local:registry&quot; and separate processes using a node at &quot;local:MyHost&quot; that holds <a href="qtremoteobjects-source.html#source">Source</a> objects. If you wanted to access these objects, but over tcp, you could create a new proxyNode like so:</p>
<pre class="cpp">

  <span class="comment">// myInternalHost is a node only visible on the device...</span>
  <span class="type"><a href="qremoteobjecthost.html">QRemoteObjectHost</a></span> myInternalHost(<span class="string">&quot;local:MyHost&quot;</span>);
  myInternalHost<span class="operator">.</span>enableRemoting<span class="operator">&lt;</span>SomeObject<span class="operator">&gt;</span>(<span class="operator">&amp;</span>someObject);

  <span class="comment">// Regular host node, listening on port 12123, so visible to other</span>
  <span class="comment">// devices</span>
  <span class="type"><a href="qremoteobjecthost.html">QRemoteObjectHost</a></span> proxyNode(<span class="string">&quot;tcp://localhost:12123&quot;</span>);

  <span class="comment">// Enable proxying objects from nodes on the local machine's internal</span>
  <span class="comment">// QtRO bus</span>
  proxyNode<span class="operator">.</span>proxy(<span class="string">&quot;local:registry&quot;</span>);

</pre>
<p>And from another device you create another node:</p>
<pre class="cpp">

  <span class="comment">// NB: localhost resolves to a different ip address than proxyNode</span>
  <span class="type"><a href="qremoteobjecthost.html">QRemoteObjectHost</a></span> nodeOnRemoteDevice(<span class="string">&quot;tcp://localhost:23234&quot;</span>);

  <span class="comment">// Connect to the target's proxyNode directly, or use a tcp registry...</span>
  nodeOnRemoteDevice<span class="operator">.</span>connectToNode(<span class="string">&quot;tcp://&lt;target device&gt;:12123&quot;</span>);

  <span class="comment">// Because of the proxy, we can get the object over tcp/ip port 12123,</span>
  <span class="comment">// even though we can't connect directly to &quot;local:MyHost&quot;</span>
  SomeObject <span class="operator">*</span>so <span class="operator">=</span> nodeOnRemoteDevice<span class="operator">.</span>acquire<span class="operator">&lt;</span>SomeObject<span class="operator">&gt;</span>();

</pre>
<p>This would (internally) create a node in proxyNode, which (again internally/automatically) connects to the provided registry (given by the <i>registryUrl</i> parameter, &quot;local:registry&quot; in this example). Whenever local:registry emits the <a href="qremoteobjectnode.html#remoteObjectAdded">remoteObjectAdded</a> signal, the <code>QRemoteObjectSourceLocation</code> is passed to the <i>filter</i> given to the proxy call. If this method returns true (the default filter simply returns true without any filtering), the object is acquired() from the internal node and <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a>() (once the replica is initialized) is called on proxyNode.</p>
<p>If a <i>hostUrl</i> is provided (which is required to enable <a href="qremoteobjecthostbase.html#reverseProxy">reverseProxy</a>, but not needed otherwise), the internal node will be a <a href="qremoteobjecthost.html">QRemoteObjectHost</a> node configured with the provided address. If no <i>hostUrl</i> is provided, the internal node will be a <a href="qremoteobjectnode.html">QRemoteObjectNode</a> (not HostNode).</p>
<p>This function was introduced in  Qt 5.11.</p>
<p><b>See also </b><a href="qremoteobjecthostbase.html#reverseProxy">reverseProxy</a>().</p>
<!-- @@@proxy -->
<!-- $$$reverseProxy[overload1]$$$reverseProxyQRemoteObjectHostBase::RemoteObjectNameFilter -->
<h3 class="fn" id="reverseProxy"><a name="reverseProxy"></a><span class="type">bool</span> QRemoteObjectHostBase::<span class="name">reverseProxy</span>(<span class="type"><a href="qremoteobjecthostbase.html#RemoteObjectNameFilter-typedef">QRemoteObjectHostBase::RemoteObjectNameFilter</a></span> <i>filter</i> = [](const QString &amp;, const QString &amp;) {return true; })</h3>
<p>Forward Remote Objects to another network</p>
<p>The reverseProxy() function allows the <a href="qremoteobjecthostbase.html#proxy">proxy</a>() functionality to be extended, in effect mirroring the proxy functionality in the &quot;reverse&quot; direction. These are distinct, because node communication is not symmetric, one side calls <a href="qremoteobjecthostbase.html#enableRemoting">enableRemoting</a>() with a <a href="qtremoteobjects-source.html#source">Source</a> object, the other side calls <a href="qremoteobjectnode.html#acquire">acquire</a>() to get a <a href="qtremoteobjects-replica.html#replica">Replica</a>. Using <a href="qremoteobjecthostbase.html#proxy">proxy</a>() allows you to &quot;observe&quot; objects on a target device remotely via acquire, but it does not allow off-target <a href="qtremoteobjects-source.html#source">Source</a> objects to be acquired from the device's local:* network. That is where reverseProxy() comes in. If a proxyNode is created like so:</p>
<pre class="cpp">

  <span class="comment">// myInternalHost is a node only visible on the device...</span>
  <span class="type"><a href="qremoteobjecthost.html">QRemoteObjectHost</a></span> myInternalHost(<span class="string">&quot;local:MyHost&quot;</span>);

  <span class="comment">// Regular host node, listening on port 12123, so visible to other</span>
  <span class="comment">// devices</span>
  <span class="type"><a href="qremoteobjecthost.html">QRemoteObjectHost</a></span> proxyNode(<span class="string">&quot;tcp://localhost:12123&quot;</span>);

  <span class="comment">// Enable proxying objects from nodes on the local machine's internal</span>
  <span class="comment">// QtRO bus.  Note the hostUrl parameter is now needed.</span>
  proxyNode<span class="operator">.</span>proxy(<span class="string">&quot;local:registry&quot;</span><span class="operator">,</span> <span class="string">&quot;local:fromProxy&quot;</span>);
  proxyNode<span class="operator">.</span>reverseProxy();

</pre>
<p>And from another device you create another node:</p>
<pre class="cpp">

  <span class="comment">// NB: localhost resolves to a different ip address than proxyNode</span>
  <span class="type"><a href="qremoteobjecthost.html">QRemoteObjectHost</a></span> nodeOnRemoteDevice(<span class="string">&quot;tcp://localhost:23234&quot;</span>);

  <span class="comment">// Connect to the target's proxyNode directly, or use a tcp registry...</span>
  nodeOnRemoteDevice<span class="operator">.</span>connectToNode(<span class="string">&quot;tcp://&lt;target device&gt;:12123&quot;</span>);

  <span class="comment">// Because of the reverseProxy, we can expose objects on this device</span>
  <span class="comment">// and they will make their way to proxyNode...</span>
  nodeOnRemoteDevice<span class="operator">.</span>enableRemoting<span class="operator">&lt;</span>OtherObject<span class="operator">&gt;</span>(<span class="operator">&amp;</span>otherObject);

</pre>
<pre class="cpp">

  <span class="comment">// Acquire() can now see the objects on other devices through proxyNode,</span>
  <span class="comment">// due to the reverseProxy call.</span>
  OtherObject <span class="operator">*</span>oo <span class="operator">=</span> myInternalHost<span class="operator">.</span>acquire<span class="operator">&lt;</span>OtherObject<span class="operator">&gt;</span>();

</pre>
<p>While the <a href="qremoteobjecthostbase.html#proxy">proxy</a>() functionality allows <a href="qtremoteobjects-source.html#source">Source</a> objects on another network to be acquired(), reverseProxy() allows <a href="qtremoteobjects-source.html#source">Source</a> objects to be &quot;pushed&quot; to an otherwise inaccessible network.</p>
<p>Note: <a href="qremoteobjecthostbase.html#proxy">proxy</a>() needs to be called before reverseProxy(), and a <i>hostUrl</i> needs to be provided to <a href="qremoteobjecthostbase.html#proxy">proxy</a> for reverseProxy() to work. The reverseProxy() method allows a separate <i>filter</i> to be applied. This reverseProxy specific filter will receive notifications of new <a href="qtremoteobjects-source.html#source">Source</a> objects on proxyNode and acquire them on the internal node if they pass the reverseFilter.</p>
<p>This function was introduced in  Qt 5.11.</p>
<p><b>See also </b><a href="qremoteobjecthostbase.html#proxy">proxy</a>().</p>
<!-- @@@reverseProxy -->
<!-- $$$setName[overload1]$$$setNameconstQString& -->
<h3 class="fn" id="setName"><a name="setName"></a><code>[override virtual] </code><span class="type">void</span> QRemoteObjectHostBase::<span class="name">setName</span>(const <span class="type">QString</span> &amp;<i>name</i>)</h3>
<p>Reimplemented from <a href="qremoteobjectnode.html#setName">QRemoteObjectNode::setName</a>().</p>
<p>Similar to QObject::setObjectName() (which this method calls), but this version also applies the <i>name</i> to internal classes as well, which are used in some of the debugging output.</p>
<!-- @@@setName -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>