1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import QtQml 2.2
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Airmap 1.0
import QGroundControl.SettingsManager 1.0
Item {
id: _root
height: checked ? (header.height + content.height) : header.height
property var rules: null
property color color: "white"
property alias text: title.text
property bool checked: false
property ExclusiveGroup exclusiveGroup: null
onExclusiveGroupChanged: {
if (exclusiveGroup) {
exclusiveGroup.bindCheckable(_root)
}
}
QGCPalette {
id: qgcPal
colorGroupEnabled: enabled
}
Rectangle {
id: header
height: ScreenTools.defaultFontPixelHeight * 2
color: qgcPal.windowShade
anchors.top: parent.top
anchors.right: parent.right
anchors.left: parent.left
}
Row {
spacing: ScreenTools.defaultFontPixelWidth * 2
anchors.fill: header
Rectangle {
height: parent.height
width: ScreenTools.defaultFontPixelWidth * 0.75
color: _root.color
}
QGCLabel {
id: title
anchors.verticalCenter: parent.verticalCenter
}
}
QGCColoredImage {
source: checked ? "qrc:/airmap/colapse.svg" : "qrc:/airmap/expand.svg"
height: ScreenTools.defaultFontPixelHeight
width: height
color: qgcPal.text
fillMode: Image.PreserveAspectFit
sourceSize.height: height
anchors.right: header.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.verticalCenter: header.verticalCenter
}
MouseArea {
anchors.fill: header
onClicked: {
_root.checked = !_root.checked
}
}
Rectangle {
id: content
color: qgcPal.window
visible: checked
height: ScreenTools.defaultFontPixelHeight * 10
anchors.top: header.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: ScreenTools.defaultFontPixelWidth
Flickable {
clip: true
anchors.fill: parent
contentHeight: rulesetCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: rulesetCol
spacing: ScreenTools.defaultFontPixelHeight * 0.25
anchors.right: parent.right
anchors.left: parent.left
Repeater {
model: _root.rules ? _root.rules : []
delegate: Item {
height: ruleCol.height
anchors.right: parent.right
anchors.left: parent.left
anchors.margins: ScreenTools.defaultFontPixelWidth
Column {
id: ruleCol
spacing: ScreenTools.defaultFontPixelHeight * 0.5
anchors.right: parent.right
anchors.left: parent.left
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
QGCLabel {
text: object.shortText !== "" ? object.shortText : qsTr("Rule")
anchors.right: parent.right
anchors.left: parent.left
wrapMode: Text.WordWrap
}
QGCLabel {
text: object.description
visible: object.description !== ""
font.pointSize: ScreenTools.smallFontPointSize
anchors.right: parent.right
anchors.left: parent.left
wrapMode: Text.WordWrap
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 0.5
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.5
}
}
}
}
Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 0.25; }
}
}
}
}