Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-113348

Confuse example on documentation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5.0
    • Remote Objects
    • None
    • Windows 10
    • Windows

    Description

      I'm following the first External QIODevices example but it's missing to demonstrate how the srcNode is being enabled.

      I tried:

          #include "rep_remoteobject_source.h"
          class RemoteObject : public RemoteObjectSource
          {
            Q_OBJECT
            //...
          }
      
          //...
          QTcpServer tcpServer;
          tcpServer.listen(QHostAddress(QStringLiteral("tcp://xxx.128.35.160")), 65214);
      
          QRemoteObjectHost srcNode;
          QObject::connect(&tcpServer, &QTcpServer::newConnection, &srcNode, [&] {
              srcNode.addHostSideConnection(tcpServer.nextPendingConnection());
          });
      
          RemoteObject remoteObject;
          bool ret = srcNode.enableRemoting(&remoteObject, "remoteObject");
          qDebug() << "enableRemoting:" << ret;
      

      But enableRemoting is returning false.

      In the documentation of enableRemoting "Returns false if the current node is a client node"

      And in the example there's a comment:
      // Create the host node. We don't need a hostUrl unless we want to take// advantage of external schemas (see next example).
      Without a hostUrl set in the srcNode, it's probably being threatened as a client.

      What's wrong?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bstottle Brett Stottlemyer
            nanao Ruan Seb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes