Invoke C++ method from webviews Javascript
问题 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