QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FactTextField.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4
5import QGroundControl
6import QGroundControl.Controls
7
8QGCTextField {
9 id: control
10 text: fact ? fact.valueString : ""
11 unitsLabel: fact ? fact.units : ""
12 showUnits: true
13 showHelp: false
14 numericValuesOnly: fact && !fact.typeIsString
15 maximumLength: fact && fact.maxStringLength > 0 ? fact.maxStringLength : 32767 // 32767 is the TextInput default (no limit)
16
17 signal updated()
18
19 property Fact fact: null
20
21 onEditingFinished: _onEditingFinished()
22
23 function _onEditingFinished() {
24 var errorString = fact.validate(text, false /* convertOnly */)
25 if (errorString === "") {
26 clearValidationError()
27 fact.value = text
28 control.updated()
29 } else {
30 showValidationError(errorString, fact.valueString)
31 }
32 }
33
34 onHelpClicked: helpDialogFactory.open()
35
36 QGCPopupDialogFactory {
37 id: helpDialogFactory
38
39 dialogComponent: helpDialogComponent
40 }
41
42 Component {
43 id: helpDialogComponent
44
45 ParameterEditorDialog {
46 title: qsTr("Value Details")
47 fact: control.fact
48 }
49 }
50}