Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to specify Qt Remote Object name in QML?
Forum Updated to NodeBB v4.3 + New Features

How to specify Qt Remote Object name in QML?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 211 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Explorer
    wrote on last edited by
    #1

    Hi,

    Any help would be appreciated, I'm a bit stuck with QML Qt Remote Objects. From QML I can't figure out how to connect to a specific QtRemoteObjects by remote object name also (not only by type).

    For example: I have several QtRemoteObjects of type "MyType" at "local:registry" Now, from QML I'm trying to connect to one of those remote objects called "RemoteObject4" by name. I can't figure out how or where to specify the remote object name in QML so it will return the object by name and not only type.

    The examples from the documentation just use the type, which will probably only work if there is one object of a type on that node/registry. e.g.

    MyTypeReplica {
          id: myType
          node: Node { registryUrl: "local:registry" }
     }
    

    Does anyone know where I should specify the name of the desired remote object in QML? Or isn't it supported yet and I should just use C++ for this?

    Thanks

    1 Reply Last reply
    0
    • E Offline
      E Offline
      Explorer
      wrote on last edited by
      #2

      After some investigation - unfortunately setNode in remoteobjects/qremoteobjectreplica.cpp doesn't pass any name parameter as a second parameter to initializeReplica(), so I guess what I want to do just isn't possible at the moment (in the current version Qt5.15).

      void QRemoteObjectReplica::setNode(QRemoteObjectNode *_node)
      {
          const QRemoteObjectNode *curNode = node();
          if (curNode) {
              qCWarning(QT_REMOTEOBJECT) << "Ignoring call to setNode as the node has already been set";
              return;
          }
          d_impl.clear();
          _node->initializeReplica(this);
      }
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved