Advertisement
Guest User

Untitled

a guest
May 3rd, 2023
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1.     QRemoteObjectNode repNode;
  2.     QTcpSocket *socket = new QTcpSocket(&repNode);
  3.     QObject::connect(_socket, &QTcpSocket::connected, &repNode,[&]()
  4.     {
  5.         qDebug() << "connected...";
  6.         repNode.addClientSideConnection(socket);
  7.  
  8.         QSharedPointer<RemoteObjectReplica> ptr;
  9.         ptr.reset(repNode.acquire<RemoteObjectReplica>("remoteObject"));
  10.  
  11.         ptr.data()->test("hello world");
  12.  
  13.         QObject::connect(ptr.data(), &RemoteObjectReplica::signalTest, &a, [](int x) {
  14.             qDebug() << "x:" << x;
  15.         });
  16.     });
  17.     socket->connectToHost(QHostAddress(QStringLiteral("127.0.0.1")), 65213);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement