QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
OfflineMapButton.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3
4import QGroundControl
5import QGroundControl.Controls
6
7Button {
8 id: mapButton
9 height: ScreenTools.defaultFontPixelHeight * 4
10 autoExclusive: true
11
12 background: Rectangle {
13 anchors.fill: parent
14 color: _showHighlight ? qgcPal.buttonHighlight : qgcPal.button
15 border.width: _showBorder ? 1: 0
16 border.color: qgcPal.buttonText
17 }
18
19 property var tileSet: null
20 property var currentSet: null
21 property bool complete: false
22 property int tiles: 0
23 property string size: ""
24
25 property bool _showHighlight: (_pressed | _hovered | checked) && !_forceHoverOff
26 property bool _showBorder: qgcPal.globalTheme === QGCPalette.Light
27
28 property bool _forceHoverOff: false
29 property int _lastGlobalMouseX: 0
30 property int _lastGlobalMouseY: 0
31 property bool _pressed: false
32 property bool _hovered: false
33
34 contentItem: Row {
35 anchors.centerIn: parent
36 anchors.margins: ScreenTools.defaultFontPixelWidth
37 QGCLabel {
38 text: mapButton.text
39 width: mapButton.width * 0.4
40 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
41 wrapMode: Text.Wrap
42 maximumLineCount: 2
43 anchors.verticalCenter: parent.verticalCenter
44 }
45 QGCLabel {
46 id: sizeLabel
47 width: mapButton.width * 0.4
48 horizontalAlignment: Text.AlignRight
49 anchors.verticalCenter: parent.verticalCenter
50 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
51 text: mapButton.size + (tiles > 0 ? " (" + tiles + " tiles)" : "")
52 }
53 Item {
54 width: ScreenTools.defaultFontPixelWidth * 2
55 height: 1
56 }
57 Rectangle {
58 width: sizeLabel.height * 0.5
59 height: sizeLabel.height * 0.5
60 radius: width / 2
61 color: complete ? "#31f55b" : "#fc5656"
62 opacity: sizeLabel.text.length > 0 ? 1 : 0
63 anchors.verticalCenter: parent.verticalCenter
64 }
65 Item {
66 width: ScreenTools.defaultFontPixelWidth * 2
67 height: 1
68 }
69 QGCColoredImage {
70 width: sizeLabel.height * 0.8
71 height: sizeLabel.height * 0.8
72 sourceSize.height: height
73 source: "/res/buttonRight.svg"
74 mipmap: true
75 fillMode: Image.PreserveAspectFit
76 color: _showHighlight ? qgcPal.buttonHighlightText : qgcPal.buttonText
77 anchors.verticalCenter: parent.verticalCenter
78 }
79 }
80}