One QML two File Html inside: how can I call javascript functions inside its from c++
Unsolved
QtWebEngine
-
hello,
INTRODUCTION PROJECT- in my project i cannot use websocket;
- I have one file QML with rectangle area that connetc at webengine
- inside rectangle area there is a form HTML, so i have FORM1 and FORM2
- I can call a C ++ function from an html button passing the values of all the elements of a FORM1 and FORM2.
How can I call a javacript function (for example functionform1 () or functionform2 ()) from C ++ ????
This is two areas whith two file html
Rectangle { id: boxLeft EngineIndexHtml { id: oldBeardedMan WebChannel.id: "wiseMan" } WebEngineView { id: viewTestEngine anchors.fill: parent url: "/html/form1.html" webChannel: channel } WebChannel { id: channel registeredObjects: [oldBeardedMan] } } Rectangle { id: boxRight EngineIndexHtml { id: idPage2 WebChannel.id: "ChannelPage2" } WebEngineView { id: viewTestEnginePage2 anchors.fill: parent url: "/html/form2.html" webChannel: channelPage2 } WebChannel { id: channelPage2 registeredObjects: [idPage2] }
This is one connect webengine in HTML (form1)
window.onload = function () { new QWebChannel(qt.webChannelTransport, function (channel) { webobj = channel.objects.wiseMan; window.foo = webobj; }); }
So i can call a function C++ from html file. For example :
foo.retriveElementValue(array_parameter);