QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
MapProviderSettings.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7/// Map provider, type, and elevation provider selection.
8/// Wraps a SettingsGroupLayout with cascading comboboxes driven by QGCMapEngineManager.
9SettingsGroupLayout {
10 Layout.fillWidth: true
11
12 property var _mapEngineManager: QGroundControl.mapEngineManager
13 property Fact _mapProviderFact: QGroundControl.settingsManager.flightMapSettings.mapProvider
14 property Fact _mapTypeFact: QGroundControl.settingsManager.flightMapSettings.mapType
15 property Fact _elevationProviderFact: QGroundControl.settingsManager.flightMapSettings.elevationMapProvider
16
17 LabelledComboBox {
18 label: qsTr("Provider")
19 model: _mapEngineManager.mapProviderList
20
21 onActivated: (index) => {
22 _mapProviderFact.rawValue = comboBox.textAt(index)
23 _mapTypeFact.rawValue = _mapEngineManager.mapTypeList(comboBox.textAt(index))[0]
24 }
25
26 Component.onCompleted: {
27 var index = comboBox.find(_mapProviderFact.rawValue)
28 if (index < 0) index = 0
29 comboBox.currentIndex = index
30 }
31 }
32
33 LabelledComboBox {
34 label: qsTr("Type")
35 model: _mapEngineManager.mapTypeList(_mapProviderFact.rawValue)
36
37 onActivated: (index) => { _mapTypeFact.rawValue = comboBox.textAt(index) }
38
39 Component.onCompleted: {
40 var index = comboBox.find(_mapTypeFact.rawValue)
41 if (index < 0) index = 0
42 comboBox.currentIndex = index
43 }
44 }
45
46 LabelledComboBox {
47 label: qsTr("Elevation Provider")
48 model: _mapEngineManager.elevationProviderList
49
50 onActivated: (index) => { _elevationProviderFact.rawValue = comboBox.textAt(index) }
51
52 Component.onCompleted: {
53 var index = comboBox.find(_elevationProviderFact.rawValue)
54 if (index < 0) index = 0
55 comboBox.currentIndex = index
56 }
57 }
58}