In qt4 qml the qtwebkit 1.0 the component webview has a property javaScriptWindowObjects
. I used it to add javaScriptWindowObjects to the context of my webpages javascript to call c++ functions. like so
WebView{
url: "http://test.com"
anchors.fill: parent
scale: 1.0
javaScriptWindowObjects: QtObject {
WebView.windowObjectName: "native"
function foo(x, y) {
console.log("This is a call from javascript");
myCppHandler.fooNative(b,c);
}
}
}
so i can call it from the webpages javascript like so
<script type="text/javascript">
native.foo(1,2)
</script>
but in qt5 qml qtwebkit 3.0 there is no such thing like javaScriptWindowObjects
how can i achieve that in qt5 qml?