QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
NTRIPMountpointList.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Layouts
3
4import QGroundControl
5import QGroundControl.Controls
6
7/// Scrollable list of NTRIP caster mountpoints. Highlights the active selection
8/// and emits mountpointSelected() when the user picks one. The model rows must
9/// expose: index, mountpoint, format, navSystem, country, bitrate, distanceKm.
10QGCListView {
11 id: root
12
13 /// Mountpoint of the active selection (rendered as highlighted / "Selected").
14 property string selectedMountpoint
15
16 signal mountpointSelected(string mountpoint)
17
18 Layout.fillWidth: true
19 Layout.preferredHeight: Math.min(root.contentHeight, ScreenTools.defaultFontPixelHeight * 20)
20 spacing: ScreenTools.defaultFontPixelHeight * 0.25
21
22 QGCPalette { id: qgcPal }
23
24 delegate: Rectangle {
25 id: entry
26
27 required property int index
28 required property string mountpoint
29 required property string format
30 required property string navSystem
31 required property string country
32 required property int bitrate
33 required property real distanceKm
34
35 width: ListView.view.width
36 height: mountRow.height + ScreenTools.defaultFontPixelHeight * 0.5
37 radius: ScreenTools.defaultFontPixelHeight * 0.25
38 color: {
39 if (entry.mountpoint === root.selectedMountpoint)
40 return qgcPal.buttonHighlight
41 return entry.index % 2 === 0 ? qgcPal.windowShade : qgcPal.window
42 }
43
44 RowLayout {
45 id: mountRow
46 anchors.left: parent.left
47 anchors.right: parent.right
48 anchors.verticalCenter: parent.verticalCenter
49 anchors.margins: ScreenTools.defaultFontPixelWidth
50
51 ColumnLayout {
52 Layout.fillWidth: true
53 spacing: 0
54
55 RowLayout {
56 spacing: ScreenTools.defaultFontPixelWidth
57
58 QGCLabel {
59 text: entry.mountpoint
60 font.bold: true
61 color: entry.mountpoint === root.selectedMountpoint
62 ? qgcPal.buttonHighlightText : qgcPal.text
63 }
64 QGCLabel {
65 visible: entry.mountpoint === root.selectedMountpoint
66 text: qsTr("(selected)")
67 font.pointSize: ScreenTools.smallFontPointSize
68 color: qgcPal.buttonHighlightText
69 }
70 }
71
72 QGCLabel {
73 text: {
74 var parts = []
75 if (entry.format) parts.push(entry.format)
76 if (entry.navSystem) parts.push(entry.navSystem)
77 if (entry.country) parts.push(entry.country)
78 if (entry.bitrate > 0) parts.push(entry.bitrate + " bps")
79 if (entry.distanceKm >= 0) parts.push(entry.distanceKm.toFixed(1) + " km")
80 return parts.join(" ยท ")
81 }
82 font.pointSize: ScreenTools.smallFontPointSize
83 color: entry.mountpoint === root.selectedMountpoint
84 ? qgcPal.buttonHighlightText : qgcPal.colorGrey
85 }
86 }
87
88 QGCButton {
89 text: entry.mountpoint === root.selectedMountpoint
90 ? qsTr("Selected") : qsTr("Select")
91 enabled: entry.mountpoint !== root.selectedMountpoint
92 onClicked: root.mountpointSelected(entry.mountpoint)
93 }
94 }
95 }
96}