Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
5b65318a
Commit
5b65318a
authored
Jun 29, 2015
by
Don Gagne
Browse files
Validation support
parent
8e9dd2f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/FactSystem/FactControls/FactTextField.qml
View file @
5b65318a
import
QtQuick
2.2
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
.
Dialogs
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
QGCTextField
{
QGCTextField
{
property
Fact
fact
:
null
id
:
_textField
text
:
fact
.
valueString
property
Fact
fact
:
null
property
string
_validateString
text
:
fact
.
valueString
unitsLabel
:
fact
.
units
unitsLabel
:
fact
.
units
onEditingFinished
:
fact
.
value
=
text
onEditingFinished
:
{
if
(
qgcView
)
{
var
errorString
=
fact
.
validate
(
text
,
false
/* convertOnly */
)
if
(
errorString
==
""
)
{
fact
.
value
=
text
}
else
{
_validateString
=
text
qgcView
.
showDialog
(
editorDialogComponent
,
"
Invalid Parameter Value
"
,
50
,
StandardButton
.
Save
)
}
}
else
{
fact
.
value
=
text
fact
.
valueChanged
(
fact
.
value
)
}
}
Component
{
id
:
editorDialogComponent
ParameterEditorDialog
{
validate
:
true
validateValue
:
_validateString
fact
:
_textField
.
fact
}
}
}
}
src/QmlControls/QGCView.qml
View file @
5b65318a
...
@@ -37,7 +37,8 @@ import QGroundControl.FactControls 1.0
...
@@ -37,7 +37,8 @@ import QGroundControl.FactControls 1.0
FactPanel
{
FactPanel
{
id
:
__rootItem
id
:
__rootItem
property
bool
completedSignalled
:
false
property
var
qgcView
:
__rootItem
/// Used by Fact controls for validation dialogs
property
bool
completedSignalled
:
false
property
var
viewPanel
property
var
viewPanel
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment