| 1 |
import QtQuick 2.0 |
| 2 |
import FlightGear 1.0 |
| 3 |
|
| 4 |
Item { |
| 5 |
property alias promptText:prompt.text |
| 6 |
property alias yesText: yesButton.text |
| 7 |
property alias noText: noButton.text |
| 8 |
|
| 9 |
// change UI appearance if yes is a destructive action |
| 10 |
property bool yesIsDestructive: false |
| 11 |
|
| 12 |
signal accepted() |
| 13 |
|
| 14 |
signal rejected() |
| 15 |
|
| 16 |
StyledText { |
| 17 |
id: prompt |
| 18 |
anchors { |
| 19 |
verticalCenter: parent.verticalCenter |
| 20 |
left: parent.left |
| 21 |
right: yesButton.left |
| 22 |
margins: Style.margin |
| 23 |
} |
| 24 |
|
| 25 |
height: parent.height |
| 26 |
verticalAlignment: Text.AlignVCenter |
| 27 |
wrapMode: Text.WordWrap |
| 28 |
} |
| 29 |
|
| 30 |
Button { |
| 31 |
id: yesButton |
| 32 |
anchors { |
| 33 |
verticalCenter: parent.verticalCenter |
| 34 |
right: noButton.left |
| 35 |
rightMargin: Style.margin |
| 36 |
} |
| 37 |
|
| 38 |
destructiveAction: parent.yesIsDestructive |
| 39 |
onClicked: parent.accepted() |
| 40 |
} |
| 41 |
|
| 42 |
Button { |
| 43 |
id: noButton |
| 44 |
|
| 45 |
anchors { |
| 46 |
verticalCenter: parent.verticalCenter |
| 47 |
right: parent.right |
| 48 |
rightMargin: Style.margin |
| 49 |
} |
| 50 |
|
| 51 |
onClicked: parent.rejected(); |
| 52 |
} |
| 53 |
|
| 54 |
} |