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