QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FileButton.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.Controls
6
7/// File Button controls used by QGCFileDialog control
8Rectangle {
9 implicitWidth: ScreenTools.implicitButtonWidth
10 implicitHeight: ScreenTools.implicitButtonHeight
11 color: highlight ? qgcPal.buttonHighlight : qgcPal.button
12 border.color: highlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
13
14 property alias text: label.text
15 property bool highlight: false
16
17 signal clicked
18 signal hamburgerClicked
19
20 property real _margins: ScreenTools.defaultFontPixelWidth / 2
21
22 QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
23
24 QGCLabel {
25 id: label
26 anchors.margins: _margins
27 anchors.left: parent.left
28 anchors.right: hamburger.left
29 anchors.top: parent.top
30 anchors.bottom: parent.bottom
31 verticalAlignment: Text.AlignVCenter
32 horizontalAlignment: Text.AlignHCenter
33 color: highlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
34 elide: Text.ElideRight
35 }
36
37 QGCColoredImage {
38 id: hamburger
39 anchors.rightMargin: _margins
40 anchors.right: parent.right
41 anchors.verticalCenter: parent.verticalCenter
42 width: _hamburgerSize
43 height: _hamburgerSize
44 sourceSize.height: _hamburgerSize
45 source: "qrc:/qmlimages/Hamburger.svg"
46 color: highlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
47
48 property real _hamburgerSize: parent.height * 0.75
49 }
50
51 QGCMouseArea {
52 anchors.fill: parent
53 onClicked: parent.clicked()
54 }
55
56 QGCMouseArea {
57 anchors.leftMargin: -_margins * 2
58 anchors.top: parent.top
59 anchors.bottom: parent.bottom
60 anchors.right: parent.right
61 anchors.left: hamburger.left
62 onClicked: parent.hamburgerClicked()
63 }
64}