QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
QGCToolBarButton.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.Controls
6
7// Important Note: Toolbar buttons must manage their checked state manually in order to support
8// view switch prevention. This means they can't be checkable or autoExclusive.
9
10Button {
11 id: button
12 height: ScreenTools.defaultFontPixelHeight * 3
13 leftPadding: _horizontalMargin
14 rightPadding: _horizontalMargin
15 checkable: false
16
17 property bool logo: false
18
19 property real _horizontalMargin: ScreenTools.defaultFontPixelWidth
20
21 onCheckedChanged: checkable = false
22
23 background: Rectangle {
24 anchors.fill: parent
25 color: button.checked ? qgcPal.buttonHighlight : Qt.rgba(0,0,0,0)
26 border.color: "red"
27 border.width: QGroundControl.corePlugin.showTouchAreas ? 3 : 0
28 }
29
30 contentItem: Row {
31 spacing: ScreenTools.defaultFontPixelWidth
32 anchors.verticalCenter: button.verticalCenter
33 QGCColoredImage {
34 id: _icon
35 height: ScreenTools.defaultFontPixelHeight * 2
36 width: height
37 sourceSize.height: parent.height
38 fillMode: Image.PreserveAspectFit
39 color: logo ? "transparent" : (button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText)
40 source: button.icon.source
41 anchors.verticalCenter: parent.verticalCenter
42 }
43 Label {
44 id: _label
45 visible: text !== ""
46 text: button.text
47 color: button.checked ? qgcPal.buttonHighlightText : qgcPal.buttonText
48 anchors.verticalCenter: parent.verticalCenter
49 }
50 }
51}