blob: 2ba4300981bda873a157f66d6b5482aa7dbd3020 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import Qt 4.7
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
wrapMode: Text.WordWrap
horizontalAlignment: "AlignHCenter"
}
}
}
|