diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2013-01-21 13:34:56 +0100 |
---|---|---|
committer | Pierre Rossi <pierre.rossi@gmail.com> | 2013-11-01 13:57:44 +0100 |
commit | fe7c20fbe3e4ada56cd9bc161e1e4376a1bd1019 (patch) | |
tree | 813b2e7822cb6fbc1a6786e563f3aec768b30d44 /examples | |
parent | 70284d66f8bdbc39a9b53030a7624dfd5f7d15ba (diff) | |
download | qtwebchannel-fe7c20fbe3e4ada56cd9bc161e1e4376a1bd1019.tar.gz |
Clarify connections between webview and webchannel.
We register objects once after the webchannel has initialized.
The web view URL on the other hand gets changed via property
binding after the web channel's base url is set/modified.
This hopefully fixes a race condition between the client-side HTML
logic and the registering of objects on the host-side QML app.
Change-Id: Ie83f7a415d9005e805a544f25287e51e75fb4dec
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qtobject/qml/qtobject/main.qml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/qtobject/qml/qtobject/main.qml b/examples/qtobject/qml/qtobject/main.qml index 05591a8..2ca26ec 100644 --- a/examples/qtobject/qml/qtobject/main.qml +++ b/examples/qtobject/qml/qtobject/main.qml @@ -75,15 +75,15 @@ Rectangle { } } - onBaseUrlChanged: publisher.registerObjects({"testObject1": testObject1, "testObject2": testObject2, "testObject3":testObject3}) + onInitialized: publisher.registerObjects({"testObject1": testObject1, "testObject2": testObject2, "testObject3":testObject3}); } width: 480 height: 800 WebView { + url: webChannel.baseUrl ? "index.html?webChannelBaseUrl=" + webChannel.baseUrl : "about:blank" anchors.fill: parent - url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl experimental.preferences.developerExtrasEnabled: true } } |