| 1 |
import QtQuick 2.4 |
| 2 |
import FlightGear 1.0 |
| 3 |
|
| 4 |
Item { |
| 5 |
property bool canMoveUp: true |
| 6 |
property bool canMoveDown: true |
| 7 |
|
| 8 |
width: height |
| 9 |
height: icon.implicitHeight + 1 |
| 10 |
visible: canMoveDown || canMoveUp |
| 11 |
|
| 12 |
signal moveUp(); |
| 13 |
signal moveDown(); |
| 14 |
|
| 15 |
Image { |
| 16 |
id: icon |
| 17 |
x: 0 |
| 18 |
y: 0 |
| 19 |
source: promptText.visible ? "image://colored-icon/reorder-small?active" |
| 20 |
: "image://colored-icon/reorder-small?text" |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
MouseArea { |
| 25 |
id: moveUpArea |
| 26 |
enabled: parent.canMoveUp |
| 27 |
hoverEnabled: enabled |
| 28 |
height: parent.height / 2 |
| 29 |
width: parent.width |
| 30 |
onClicked: { |
| 31 |
parent.moveUp(); |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
MouseArea { |
| 36 |
id: moveDownArea |
| 37 |
enabled: parent.canMoveDown |
| 38 |
hoverEnabled: enabled |
| 39 |
height: parent.height / 2 |
| 40 |
width: parent.width |
| 41 |
anchors.bottom: parent.bottom |
| 42 |
onClicked: { |
| 43 |
parent.moveDown(); |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
Text { |
| 48 |
id: promptText |
| 49 |
anchors.verticalCenter: parent.verticalCenter |
| 50 |
anchors.right: parent.left |
| 51 |
anchors.rightMargin: Style.margin |
| 52 |
visible: moveUpArea.containsMouse || moveDownArea.containsMouse |
| 53 |
text: moveUpArea.containsMouse ? qsTr("Move up") : qsTr("Move down") |
| 54 |
} |
| 55 |
} |