summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/visual/webview/javascript/evaluateJavaScript.qml
blob: 78d5cfcc362660d6f8a6a316f9234aa7051e1d76 (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
30
31
import Qt 4.6

Column {
    WebView {
        id: webview
        width: 200
        height: 200
        url: "test-objects.html"
        javaScriptWindowObjects:
            QtObject {
                property string text: btntext.text
                WebView.windowObjectName: "qmltext"
                onTextChanged: {
                    webview.evaluateJavaScript("{document.getElementById('button').value=window.qmltext.text}")
                }
            }
    }
    Row {
        Text { text: "Input:" }
        Rectangle {
            width: btntext.width+10
            height: btntext.height+10
            border.color: "black"
            TextInput {
                id: btntext
                text: "Blah"
                cursorDelegate: Rectangle { width: 1; color: "red" }
            }
        }
    }
}