forked from UAVGCSTeam/GCS
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMapDisplayTypeButton.qml
More file actions
45 lines (36 loc) · 1.28 KB
/
MapDisplayTypeButton.qml
File metadata and controls
45 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Basic
import "qrc:/gcsStyle" as GcsStyle
Button {
id: mapTypeButton
property var mapTypes: ["Street", "Satellite", "Terrain"]
property int currentTypeIndex: 0
text: "Map Type: " + mapTypes[currentTypeIndex]
onClicked: {
// Call our mapController.cpp logic
currentTypeIndex = (currentTypeIndex + 1) % mapTypes.length
mapController.changeMapType(currentTypeIndex)
}
background: Rectangle {
// color: "white"
color: mapTypeButton.pressed ? GcsStyle.PanelStyle.secondaryColor : GcsStyle.PanelStyle.buttonColor2
border.color: GcsStyle.PanelStyle.defaultBorderColor
border.width: GcsStyle.PanelStyle.defaultBorderWidth
radius: GcsStyle.PanelStyle.buttonRadius
}
contentItem: Text {
text: mapTypeButton.text
font.pixelSize: GcsStyle.PanelStyle.fontSizeSmall
font.family: GcsStyle.PanelStyle.fontFamily
color: GcsStyle.PanelStyle.textPrimaryColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Connections {
target: mapController
function onMapTypeChanged(typeIndex) {
currentTypeIndex = typeIndex
}
}
}