diff options
author | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-06-30 17:10:26 -0700 |
---|---|---|
committer | No'am Rosenthal <noam.rosenthal@nokia.com> | 2011-06-30 17:10:26 -0700 |
commit | 22dce6d37782bcf4430ec52bbf905285c03faf29 (patch) | |
tree | c240a2a6f3eb8d1d25ef5776ea0497a94b9d546d /examples | |
download | qtwebchannel-22dce6d37782bcf4430ec52bbf905285c03faf29.tar.gz |
QWebChannel
Diffstat (limited to 'examples')
-rw-r--r-- | examples/qmlapp/index.html | 16 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qml | 29 | ||||
-rw-r--r-- | examples/qmlapp/qmlapp.qmlproject | 20 |
3 files changed, 65 insertions, 0 deletions
diff --git a/examples/qmlapp/index.html b/examples/qmlapp/index.html new file mode 100644 index 0000000..981b208 --- /dev/null +++ b/examples/qmlapp/index.html @@ -0,0 +1,16 @@ +<html> + <head> + <script src="../src/qwebchannel.js"></script> + <script> + function load() { + navigator.webChannel.init(); + navigator.webChannel.exec({a:1}, function(response) { + document.body.innerHTML = response.b; + }); + } + </script> + </head> + <body onload="load()"> + <div>444</div> + </body> +</html> diff --git a/examples/qmlapp/qmlapp.qml b/examples/qmlapp/qmlapp.qml new file mode 100644 index 0000000..1c7f4e2 --- /dev/null +++ b/examples/qmlapp/qmlapp.qml @@ -0,0 +1,29 @@ +import QtQuick 1.0 +import Qt.labs.WebChannel 1.0 +import QtWebKit 2.0 + +Rectangle { + width: 1000 + height: 360 + WebChannel { + id: webus + useSecret: false + onRequest: { + var data = JSON.parse(request); + response.send(JSON.stringify({b:'goodbye ' + data.a})); + } + } + + WebView { + id: webView + anchors.top: parent.top + settings.localContentCanAccessRemoteUrls: true + settings.developerExtrasEnabled: true + url: "index.html?baseUrl=" + webus.baseUrl + } + + Text { + id: txt + anchors.top: webView.bottom + } +} diff --git a/examples/qmlapp/qmlapp.qmlproject b/examples/qmlapp/qmlapp.qmlproject new file mode 100644 index 0000000..4a6891a --- /dev/null +++ b/examples/qmlapp/qmlapp.qmlproject @@ -0,0 +1,20 @@ +/* File generated by QtCreator */ + +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + + importPaths: ["/home/noam/depot/webus"] + /* List of plugin directories passed to QML runtime */ + // importPaths: [ "../exampleplugin" ] +} |