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. Unable to connect QML Remote Object with error "connectionToSource is null"
QtWS25 Last Chance

Unable to connect QML Remote Object with error "connectionToSource is null"

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 565 Views
  • 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.
  • J Offline
    J Offline
    jay1
    wrote on last edited by jay1
    #1

    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.

    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