Unsolved Unable to connect QML Remote Object with error "connectionToSource is null"
-
I am trying to use Qt Remote Objects for creating client server application.
But encountered an issue that says "connectionToSource is null". How do I set the source connection ?I am creating the server using the .rep file. The code I had used is as follows:
Server Code
// DataBroadcaster class inherits CustomModelSimpleSource.h (generated from .rep file) DataBroadcaster dataServer; QRemoteObjectHost host; host.setHostUrl(QUrl(QStringLiteral("local:mydata"))); host.enableRemoting(&dataServer, "MyDataTag");
Client Code
// CustomModelDataReplica is generated from .rep file used to generate source // registered as qml type in main qmlRegisterType<CustomModelDataReplica>("CustomData", 1, 0, "MyData");
// Added to QML file
import CustomData 1.0 MyData { id: dataClient node: Node { registerUrl: "local:mydata" } Button { id: btn text: "Server Data" onClicked: { // displaying some data from source btn.text = dataClient.myprop } } }
Execution:
Server code is running Client code is running but when trying to get data I get following error message in debugger **"qt.remoteobjects: connectionToSource is null"**
I am unable to figure out what am I missing.
If anyone has any idea about how to resolve or where to look for please suggest.