示例来源于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
把这个属性设置成真!