equal
deleted
inserted
replaced
|
1 import Qt 4.6 |
|
2 |
|
3 Rectangle { |
|
4 property string text: "" |
|
5 property int size: 0 |
|
6 signal confirmed(string input); |
|
7 |
|
8 id: page |
|
9 opacity: 0 |
|
10 |
|
11 width: dialogText.width + 30 + size; height: dialogText.height + okButton.height + inputText.height + 44 |
|
12 anchors.verticalCenter: mainWindow.verticalCenter |
|
13 anchors.horizontalCenter: mainWindow.horizontalCenter |
|
14 |
|
15 border.width: 1; color: "lightgray"; radius: 5 |
|
16 |
|
17 Text { |
|
18 id: dialogText |
|
19 text: page.text |
|
20 x: 15; y: 15 |
|
21 color: activePalette.buttonText |
|
22 } |
|
23 |
|
24 Rectangle { |
|
25 id: inputArea |
|
26 width: page.width - 30 |
|
27 height: inputText.height + 4 |
|
28 border.width: 1; color: "white"; radius: 1 |
|
29 anchors.left: dialogText.left |
|
30 anchors.top: dialogText.bottom; anchors.topMargin: 7 |
|
31 } |
|
32 |
|
33 TextInput { |
|
34 id: inputText |
|
35 width: inputArea.width - 10 |
|
36 anchors.verticalCenter: inputArea.verticalCenter |
|
37 anchors.horizontalCenter: inputArea.horizontalCenter |
|
38 } |
|
39 |
|
40 Button { |
|
41 id: okButton |
|
42 text: "Ok" |
|
43 width: 75; height: 25 |
|
44 anchors.right: page.horizontalCenter; anchors.rightMargin: 5 |
|
45 anchors.top: inputArea.bottom; anchors.topMargin: 10 |
|
46 |
|
47 onClicked: { |
|
48 page.confirmed(inputText.text); |
|
49 forceClose(); |
|
50 } |
|
51 } |
|
52 |
|
53 Button { |
|
54 id: noButton |
|
55 text: "Cancel" |
|
56 width: 75; height: 25 |
|
57 anchors.left: page.horizontalCenter; anchors.leftMargin: 5 |
|
58 anchors.top: inputArea.bottom; anchors.topMargin: 10 |
|
59 |
|
60 onClicked: { |
|
61 forceClose(); |
|
62 } |
|
63 } |
|
64 |
|
65 function forceClose() |
|
66 { |
|
67 page.opacity = 0; |
|
68 inputText.text = ""; |
|
69 } |
|
70 } |