summaryrefslogtreecommitdiff
path: root/examples/qmlapp/qmlapp.qml
blob: c8d6cae9720fae528ab7d64a8476243cfe9f67ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import QtQuick 1.0
import Qt.labs.WebChannel 1.0
import QtWebKit 1.0

Rectangle {
    width: 1000
    height: 360
    WebChannel {
        id: webChannel
        useSecret: false
        onRequest: {
            var data = JSON.parse(request);
            response.send(JSON.stringify({b:'This is a response from QML'}));
        }
    }

    WebView {
        id: webView
        anchors.top: parent.top
        settings.localContentCanAccessRemoteUrls: true
        settings.developerExtrasEnabled: true
        url: "index.html?baseUrl=" + webChannel.baseUrl
    }

    Text {
        id: txt
        anchors.top: webView.bottom
    }
}