diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2010-04-08 10:11:44 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2010-04-08 10:11:44 (GMT) |
commit | 3c546be51dbdc1064a14cfcd178f7fbb5c6bff75 (patch) | |
tree | ef71de22ce4aa42726c2715b2bac42fe3f6646fb /examples/declarative/webview/alerts.qml | |
parent | 4c425feb08cd4aad31a99e92fec3fbbde0349d95 (diff) | |
parent | d248e431e259cdb31c7634507a09a9f6d39711c3 (diff) | |
download | Qt-3c546be51dbdc1064a14cfcd178f7fbb5c6bff75.zip Qt-3c546be51dbdc1064a14cfcd178f7fbb5c6bff75.tar.gz Qt-3c546be51dbdc1064a14cfcd178f7fbb5c6bff75.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7
Diffstat (limited to 'examples/declarative/webview/alerts.qml')
-rw-r--r-- | examples/declarative/webview/alerts.qml | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/examples/declarative/webview/alerts.qml b/examples/declarative/webview/alerts.qml new file mode 100644 index 0000000..ab2e860 --- /dev/null +++ b/examples/declarative/webview/alerts.qml @@ -0,0 +1,58 @@ +import Qt 4.6 +import org.webkit 1.0 + +WebView { + id: webView + onAlert: popup.show(message) + width: 120 + height: 150 + url: "alerts.html" + + Rectangle { + id: popup + + color: "red" + border.color: "black" + border.width: 2 + radius: 4 + + y: parent.height // off "screen" + anchors.horizontalCenter: parent.horizontalCenter + width: label.width+5 + height: label.height+5 + + opacity: 0 + + function show(t) { + label.text = t + popup.state = "visible" + timer.start() + } + states: State { + name: "visible" + PropertyChanges { target: popup; opacity: 1 } + PropertyChanges { target: popup; y: (webView.height-popup.height)/2 } + } + + transitions: [ + Transition { from: ""; PropertyAnimation { properties: "opacity,y"; duration: 65 } }, + Transition { from: "visible"; PropertyAnimation { properties: "opacity,y"; duration: 500 } } + ] + + Timer { + id: timer + interval: 1000 + onTriggered: popup.state = "" + } + + Text { + id: label + anchors.centerIn: parent + color: "white" + font.pixelSize: 20 + width: webView.width*0.75 + wrap: true + horizontalAlignment: "AlignHCenter" + } + } +} |