Using WebChannel and WebEngine IPC to get access to QtObjects from HTML
Solved
General and Desktop
-
Hi all,
I'm trying to establish a connection between the HTML and QtQuick Application. On the QML Side I create an QtObject and add it to the WebChannel
QtObject{ id: rotateID WebChannel.id: "rotateJS" function screenOrientation(value){ //do something } } WebEngineView { id: webEngine WebChannel{ id: testobject registeredObjects: [rotateID] } }
Inside the HTML I'm using the
qwebchannel.js
and try to call this functionnew QWebChannel(qt.webChannelTransport, function (channel) { channel.rotateJS.screenOrientation("portrait"); });
Unfortunately it seems that the communction via the WebEngine IPC doesn't work. Does anyone have experience with this?
Best,
Dominator -
you can check if there are any javascript errors on the console.