QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
TcpSettings.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Layouts
4
5import QGroundControl
6import QGroundControl.Controls
7
8GridLayout {
9 columns: 2
10 rowSpacing: _rowSpacing
11 columnSpacing: _colSpacing
12
13 function saveSettings() {
14 subEditConfig.host = hostField.text.trim()
15 subEditConfig.port = parseInt(portField.text)
16 }
17
18 QGCLabel { text: qsTr("Server Address") }
19 QGCTextField {
20 id: hostField
21 Layout.preferredWidth: _secondColumnWidth
22 text: subEditConfig.host
23 placeholderText: qsTr("localhost or 192.168.1.1")
24
25 // Allow IPv4, IPv6, hostnames, and domain names
26 // This is permissive - actual validation happens at connection time
27 validator: RegularExpressionValidator {
28 // Allow alphanumeric, dots, colons, hyphens, and brackets (for IPv6)
29 regularExpression: /^[a-zA-Z0-9\.\-:\[\]]+$/
30 }
31 }
32
33 QGCLabel { text: qsTr("Port") }
34 QGCTextField {
35 id: portField
36 Layout.preferredWidth: _secondColumnWidth
37 text: subEditConfig.port.toString()
38 inputMethodHints: Qt.ImhFormattedNumbersOnly
39 placeholderText: qsTr("5760")
40
41 validator: IntValidator {
42 bottom: 1
43 top: 65535
44 }
45 }
46
47 // Help text
48 QGCLabel {
49 Layout.columnSpan: 2
50 Layout.preferredWidth: _secondColumnWidth
51 Layout.fillWidth: true
52 font.pointSize: ScreenTools.smallFontPointSize
53 wrapMode: Text.WordWrap
54 text: qsTr("You can enter an IP address (e.g. 192.168.1.1) or hostname (e.g. my-drone.local)")
55 color: qgcPal.text
56 }
57}