diff options
Diffstat (limited to 'examples/hybridshell/qml/hybridshell/main.qml')
-rw-r--r-- | examples/hybridshell/qml/hybridshell/main.qml | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/examples/hybridshell/qml/hybridshell/main.qml b/examples/hybridshell/qml/hybridshell/main.qml index c46aaa2..d6d598d 100644 --- a/examples/hybridshell/qml/hybridshell/main.qml +++ b/examples/hybridshell/qml/hybridshell/main.qml @@ -51,27 +51,33 @@ Rectangle { id: shell onStdoutData: { console.log(data); - webChannel.broadcast("stdout", data); + webChannel.sendMessage("stdout", data); } onStderrData: { - webChannel.broadcast("stderr", data); + console.error(data); + webChannel.sendMessage("stderr", data); } } WebChannel { id: webChannel - onExecute: { - shell.exec(requestData); + onRawMessageReceived: { + shell.exec(JSON.parse(rawMessage).data); } - onBaseUrlChanged: shell.start() + onInitialized: { + shell.start() + webView.url = "index.html?webChannelBaseUrl=" + webChannel.baseUrl; + } } width: 480 height: 800 WebView { + id: webView anchors.fill: parent - url: "index.html?webChannelBaseUrl=" + webChannel.baseUrl + url: "about:blank" + experimental.preferences.developerExtrasEnabled: true } } |