6import QGroundControl.Controls
10 padding: ScreenTools.comboBoxPadding
12 property string labelText: qsTr("Options")
14 signal itemClicked(int index)
16 property var _controlQGCPal: QGCPalette { colorGroupEnabled: enabled }
17 property bool _flashChecked
18 property string _flashText
19 property bool _showFlash: false
21 Component.onCompleted: indicator.color = Qt.binding(function() { return _controlQGCPal.text })
23 background: Rectangle {
24 implicitWidth: ScreenTools.implicitComboBoxWidth
25 implicitHeight: ScreenTools.implicitComboBoxHeight
26 color: _controlQGCPal.window
27 border.width: enabled ? 1 : 0
31 /*! Adding the Combobox list item to the theme. */
33 delegate: ItemDelegate {
34 implicitHeight: modelData.visible ?
35 (Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)) :
39 enabled: modelData.enabled
42 property var _checkedValue: 1
43 property var _uncheckedValue: 0
44 property var _itemQGCPal: QGCPalette { colorGroupEnabled: enabled }
45 property var _control: control
47 Binding on checked { value: modelData.fact ?
48 (modelData.fact.typeIsBool ? (modelData.fact.value === false ? Qt.Unchecked : Qt.Checked) : (modelData.fact.value === 0 ? Qt.Unchecked : Qt.Checked)) :
51 contentItem: RowLayout {
52 spacing: ScreenTools.defaultFontPixelWidth
55 height: ScreenTools.defaultFontPixelHeight
57 border.color: _itemQGCPal.buttonText
59 color: _itemQGCPal.button
62 anchors.centerIn: parent
63 width: parent.width * 0.75
65 source: "/qmlimages/checkbox-check.svg"
66 color: _itemQGCPal.buttonText
68 fillMode: Image.PreserveAspectFit
69 sourceSize.height: height
76 color: _itemQGCPal.buttonText
81 background: Rectangle {
82 color: _controlQGCPal.button
87 modelData.fact.value = (checked ? _checkedValue : _uncheckedValue)
91 _control._flashChecked = checked
92 _control._flashText = text
93 _control._showFlash = true
94 _control.popup.close()
98 /*! This defines the label of the button. */
100 implicitWidth: _showFlash ? flash.implicitWidth : text.implicitWidth
101 implicitHeight: _showFlash ? flash.implicitHeight : text.implicitHeight
105 anchors.verticalCenter: parent.verticalCenter
107 color: _controlQGCPal.text
113 anchors.verticalCenter: parent.verticalCenter
114 spacing: ScreenTools.defaultFontPixelWidth
128 onTriggered: _showFlash = false
132 height: ScreenTools.defaultFontPixelHeight
134 border.color: _controlQGCPal.buttonText
136 color: _controlQGCPal.window
139 anchors.centerIn: parent
140 width: parent.width * 0.75
142 source: "/qmlimages/checkbox-check.svg"
143 color: _controlQGCPal.text
145 fillMode: Image.PreserveAspectFit
146 sourceSize.height: height
147 visible: _flashChecked
153 color: _controlQGCPal.buttonText