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: _showSelected ? qgcPal.accentSubtle : qgcPal.windowCard
15 border.width: 1
16 border.color: _showHighlight ? qgcPal.accent : qgcPal.borderSubtle
17 radius: ScreenTools.defaultBorderRadius
18 }
19
20 property var tileSet: null
21 property var currentSet: null
22 property bool complete: false
23 property int tiles: 0
24 property string size: ""
25
26 property bool _showHighlight: (_pressed || _hovered || checked) && !_forceHoverOff
27 property bool _showSelected: (_pressed || checked) && !_forceHoverOff
28
29 property bool _forceHoverOff: false
30 property int _lastGlobalMouseX: 0
31 property int _lastGlobalMouseY: 0
32 property bool _pressed: false
33 property bool _hovered: false
34
35 contentItem: Row {
36 anchors.centerIn: parent
37 anchors.margins: ScreenTools.defaultFontPixelWidth
38 QGCLabel {
39 text: mapButton.text
40 width: mapButton.width * 0.4
41 color: qgcPal.textPrimary
42 wrapMode: Text.Wrap
43 maximumLineCount: 2
44 anchors.verticalCenter: parent.verticalCenter
45 }
46 QGCLabel {
47 id: sizeLabel
48 width: mapButton.width * 0.4
49 horizontalAlignment: Text.AlignRight
50 anchors.verticalCenter: parent.verticalCenter
51 color: qgcPal.textPrimary
52 text: mapButton.size + (tiles > 0 ? " (" + tiles + " tiles)" : "")
53 }
54 Item {
55 width: ScreenTools.defaultFontPixelWidth * 2
56 height: 1
57 }
58 Rectangle {
59 width: sizeLabel.height * 0.5
60 height: sizeLabel.height * 0.5
61 radius: width / 2
62 color: complete ? "#31f55b" : "#fc5656"
63 opacity: sizeLabel.text.length > 0 ? 1 : 0
64 anchors.verticalCenter: parent.verticalCenter
65 }
66 Item {
67 width: ScreenTools.defaultFontPixelWidth * 2
68 height: 1
69 }
70 QGCColoredImage {
71 width: sizeLabel.height * 0.8
72 height: sizeLabel.height * 0.8
73 sourceSize.height: height
74 source: "/res/buttonRight.svg"
75 mipmap: true
76 fillMode: Image.PreserveAspectFit
77 color: qgcPal.textPrimary
78 anchors.verticalCenter: parent.verticalCenter
79 }
80 }
81}