equal
deleted
inserted
replaced
|
1 import Qt 4.6 |
|
2 |
|
3 Rectangle { |
|
4 property string text: "" |
|
5 property bool alert: false |
|
6 signal confirmed(); |
|
7 |
|
8 id: page |
|
9 opacity: 0 |
|
10 border.width: 1; color: "lightgray"; radius: 5 |
|
11 |
|
12 width: 200; height: dialogText.height + okButton.height + 35 |
|
13 anchors.verticalCenter: mainWindow.verticalCenter |
|
14 anchors.horizontalCenter: mainWindow.horizontalCenter |
|
15 |
|
16 Text { |
|
17 id: dialogText |
|
18 text: page.text |
|
19 wrap: true |
|
20 x: 15; y: 15 |
|
21 color: activePalette.buttonText |
|
22 anchors.horizontalCenter: page.horizontalCenter |
|
23 } |
|
24 |
|
25 Button { |
|
26 id: okButton |
|
27 text: "Ok" |
|
28 width: 75; height: 25 |
|
29 anchors.top: dialogText.bottom; anchors.topMargin: 7 |
|
30 |
|
31 onClicked: { |
|
32 page.confirmed(); |
|
33 page.opacity = 0; |
|
34 } |
|
35 } |
|
36 |
|
37 Button { |
|
38 id: noButton |
|
39 text: "Cancel" |
|
40 width: 75; height: 25 |
|
41 anchors.left: page.horizontalCenter; anchors.leftMargin: 5 |
|
42 anchors.top: dialogText.bottom; anchors.topMargin: 7 |
|
43 |
|
44 onClicked: { |
|
45 page.opacity = 0; |
|
46 } |
|
47 } |
|
48 |
|
49 Component.onCompleted: { |
|
50 if (alert == true) |
|
51 { |
|
52 noButton.opacity = 0; |
|
53 okButton.anchors.horizontalCenter = page.horizontalCenter; |
|
54 } |
|
55 else { |
|
56 okButton.anchors.right = page.horizontalCenter; |
|
57 okButton.anchors.rightMargin = 5; |
|
58 } |
|
59 } |
|
60 } |