Debian Codegraph @

src/GUI/qml/ToggleBox.qml

raw
1 import QtQuick 2.4
2 import FlightGear 1.0
3
4 Item {
5 property bool enabled: true
6 property alias label: switchToggle.label
7 property alias selected: switchToggle.checked
8
9 readonly property int contentVerticalOffset: switchToggle.height + Style.margin
10 readonly property int __lineTop: switchToggle.height * 0.5
11
12 ToggleSwitch {
13 enabled: parent.enabled
14 id: switchToggle
15 x: Style.strutSize
16 }
17
18 readonly property string lineColor: enabled ? Style.themeColor : Style.disabledThemeColor
19
20 // we want to show a border, but with a cut out. Easiest is to use
21 // 1px rectangles as lines
22 Rectangle { height: 1; color: lineColor; y: __lineTop; width: switchToggle.x }
23 Rectangle { height: 1; color: lineColor; y: __lineTop; anchors { left: switchToggle.right; right: parent.right;} }
24 Rectangle { height: 1; color: lineColor; width: parent.width; anchors.bottom: parent.bottom }
25 }