summaryrefslogtreecommitdiff
path: root/examples/qtobject/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qtobject/main.qml')
-rw-r--r--examples/qtobject/main.qml16
1 files changed, 7 insertions, 9 deletions
diff --git a/examples/qtobject/main.qml b/examples/qtobject/main.qml
index 7bfe714..d8ec54b 100644
--- a/examples/qtobject/main.qml
+++ b/examples/qtobject/main.qml
@@ -49,23 +49,21 @@ import QtWebKit.experimental 1.0
Rectangle {
TestObjectFactory {
id: factory
+ WebChannel.id: "testObjectFactory"
}
TestObject {
id: testObject
objectName: "initialTestObject"
+ WebChannel.id: objectName
}
WebChannel {
id: webChannel
- onInitialized: {
- registerObjects({
- "testObjectFactory": factory,
- "initialTestObject": testObject
- });
-
- webView.url = "qrc:/index.html?webChannelBaseUrl=" + webChannel.baseUrl;
- }
+ registeredObjects: [
+ factory,
+ testObject
+ ];
}
width: 480
@@ -73,7 +71,7 @@ Rectangle {
WebView {
id: webView
- url: "about:blank"
+ url: webChannel.baseUrl ? ("qrc:/index.html?webChannelBaseUrl=" + webChannel.baseUrl) : "about:blank";
anchors.fill: parent
experimental.preferences.developerExtrasEnabled: true
}