Debian Codegraph @

src/GUI/qml/AdvancedSettingsToggle.qml

raw
1 import QtQuick 2.4
2 import FlightGear 1.0
3
4 Item {
5 id: root
6 property bool open: false
7
8 implicitWidth: label.width + gearIcon.width + Style.margin
9 implicitHeight: label.height
10
11 state: "closed"
12
13 states: [
14 State {
15 name: "closed"
16 when: !root.open
17 PropertyChanges { target: label; text: qsTr("Show more") }
18 },
19
20
21
22 State {
23 name: "open"
24 when: root.open
25 PropertyChanges { target: label; text: qsTr("Show less") }
26 }
27
28 ]
29
30 Text {
31 id: label
32 anchors.right: gearIcon.left
33 anchors.rightMargin: Style.margin
34 anchors.verticalCenter: parent.verticalCenter
35 color: Style.themeContrastTextColor
36 font.underline: mouse.containsMouse
37 font.pixelSize: Style.baseFontPixelSize
38 }
39
40
41 Image {
42 id: gearIcon
43 source: "image://colored-icon/settings?themeContrast"
44 height: root.height - 2
45 fillMode: Image.PreserveAspectFit
46 anchors.right: parent.right
47 anchors.rightMargin: Style.inset
48 anchors.verticalCenter: parent.verticalCenter
49
50 }
51
52 MouseArea {
53 id: mouse
54 anchors.fill: parent
55 hoverEnabled: true
56 onClicked: open = !open
57 cursorShape: Qt.PointingHandCursor
58 }
59 }