Newer
Older
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
Rectangle {
width: ScreenTools.defaultFontPixelWidth * 0.75
}
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.rightMargin: ScreenTools.defaultFontPixelWidth
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
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; }
}
}