QML中webview元素的javaScriptWindowObjects的使用示例
2012-10-09 09:59
1161 查看
示例来源于Qt自己的帮助文档(QML WebView):
This example shows how to call into a QML method using a window object.
这个例子显示的是如何使用window对象来调用qml中的方法:
If Javascript is not enabled for the page, then this property does nothing.
当然能够使用js的前提是在webview中允许使用js,设置方法是:
settings.javascriptEnabled : bool
把这个属性设置成真!
This example shows how to call into a QML method using a window object.
这个例子显示的是如何使用window对象来调用qml中的方法:
WebView { javaScriptWindowObjects: QtObject { WebView.windowObjectName: "qml" function qmlCall() { console.log("This call is in QML!"); } } html: "<script>window.qml.qmlCall();</script>" }
If Javascript is not enabled for the page, then this property does nothing.
当然能够使用js的前提是在webview中允许使用js,设置方法是:
settings.javascriptEnabled : bool
把这个属性设置成真!
相关文章推荐
- QML中WebView的runJavaScript() 函数使用注意
- [iOS] 使用WebViewJavascriptBridge实现OC与JS交互
- android在WebView中使用JavaScript
- 在QML webview中使用alert及confirm Dialogs
- Qt 5.6.0 使用QML在某些情况下一构造WebView/WebEngineView就出错的一种解决办法
- WebviewJavascriptBridge的使用与介绍
- WebViewJavascriptBridge使用
- Android WebView中的JavaScript代码使用
- WebView中的JavaScript代码使用 setWebChromeClient
- 使用WebView中的Javascript和本地代码交互
- Android 4.2版本以下使用WebView组件addJavascriptInterface方法存在JS漏洞
- 使用WebView中的JavaScript调用android的方法
- WebViewJavascriptBridge详细使用
- android webview中使用Java调用JavaScript方法并获取返回值
- WebViewJavascriptBridge 使用 js调iOS原生代码
- Android WebView 使用JavaScript注意事项
- Android中WebView的使用总结及Java与Javascript的相互调用
- Android webview app 直接使用注入 javascript 解决中文输入问题
- iOS和JS互调--WebViewJavascriptBridge使用说明
- 【Android】不使用WebView来执行Javascript脚本(Rhino)