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: qgcPal.textPrimary
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: checked || pressed ? qgcPal.accentSubtle : (enabled && hovered ? qgcPal.windowCard : "transparent")
28 border.width: checked || pressed ? 1 : 0
29 border.color: qgcPal.accent
30 radius: ScreenTools.defaultFontPixelWidth / 2
31 }
32
33 contentItem: RowLayout {
34 spacing: ScreenTools.defaultFontPixelWidth
35
36 QGCColoredImage {
37 source: control.icon.source
38 color: control.icon.color
39 width: ScreenTools.defaultFontPixelHeight
40 height: ScreenTools.defaultFontPixelHeight
41 }
42
43 QGCLabel {
44 id: displayText
45 Layout.fillWidth: true
46 text: control.text
47 color: control.textColor
48 horizontalAlignment: QGCLabel.AlignLeft
49 }
50
51 QGCColoredImage {
52 visible: control.expandable
53 source: "/InstrumentValueIcons/cheveron-right.svg"
54 color: control.textColor
55 width: ScreenTools.defaultFontPixelHeight * 0.75
56 height: width
57 rotation: control.expanded ? 90 : 0
58
59 MouseArea {
60 anchors.fill: parent
61 anchors.margins: -ScreenTools.defaultFontPixelWidth
62 onClicked: control.toggleExpand()
63 }
64 }
65 }
66}