QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
SettingsButton.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7
8Button {
9 id: control
10 padding: ScreenTools.defaultFontPixelWidth * 0.75
11 hoverEnabled: !ScreenTools.isMobile
12 autoExclusive: true
13 icon.color: textColor
14
15 property color textColor: checked || pressed ? qgcPal.buttonHighlightText : qgcPal.buttonText
16 property bool expandable: false
17 property bool expanded: false
18
19 signal toggleExpand()
20
21 QGCPalette {
22 id: qgcPal
23 colorGroupEnabled: control.enabled
24 }
25
26 background: Rectangle {
27 color: qgcPal.buttonHighlight
28 opacity: checked || pressed ? 1 : enabled && hovered ? .2 : 0
29 radius: ScreenTools.defaultFontPixelWidth / 2
30 }
31
32 contentItem: RowLayout {
33 spacing: ScreenTools.defaultFontPixelWidth
34
35 QGCColoredImage {
36 source: control.icon.source
37 color: control.icon.color
38 width: ScreenTools.defaultFontPixelHeight
39 height: ScreenTools.defaultFontPixelHeight
40 }
41
42 QGCLabel {
43 id: displayText
44 Layout.fillWidth: true
45 text: control.text
46 color: control.textColor
47 horizontalAlignment: QGCLabel.AlignLeft
48 }
49
50 QGCColoredImage {
51 visible: control.expandable
52 source: "/InstrumentValueIcons/cheveron-right.svg"
53 color: control.textColor
54 width: ScreenTools.defaultFontPixelHeight * 0.75
55 height: width
56 rotation: control.expanded ? 90 : 0
57
58 MouseArea {
59 anchors.fill: parent
60 anchors.margins: -ScreenTools.defaultFontPixelWidth
61 onClicked: control.toggleExpand()
62 }
63 }
64 }
65}