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
62e45635
Commit
62e45635
authored
Jan 02, 2016
by
Don Gagne
Browse files
Show enumStringValue if available
parent
140c572f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/QmlControls/ParameterEditorDialog.qml
View file @
62e45635
...
@@ -35,6 +35,8 @@ import QGroundControl.FactControls 1.0
...
@@ -35,6 +35,8 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
QGCViewDialog
{
QGCViewDialog
{
id
:
root
property
Fact
fact
property
Fact
fact
property
bool
validate
:
false
property
bool
validate
:
false
property
string
validateValue
property
string
validateValue
...
@@ -42,14 +44,19 @@ QGCViewDialog {
...
@@ -42,14 +44,19 @@ QGCViewDialog {
ParameterEditorController
{
id
:
controller
;
factPanel
:
parent
}
ParameterEditorController
{
id
:
controller
;
factPanel
:
parent
}
function
accept
()
{
function
accept
()
{
var
errorString
=
fact
.
validate
(
valueField
.
text
,
forceSave
.
checked
)
if
(
factCombo
.
visible
)
{
if
(
errorString
==
""
)
{
fact
.
enumIndex
=
factCombo
.
currentIndex
fact
.
value
=
valueField
.
text
fact
.
valueChanged
(
fact
.
value
)
hideDialog
()
hideDialog
()
}
else
{
}
else
{
validationError
.
text
=
errorString
var
errorString
=
fact
.
validate
(
valueField
.
text
,
forceSave
.
checked
)
forceSave
.
visible
=
true
if
(
errorString
==
""
)
{
fact
.
value
=
valueField
.
text
fact
.
valueChanged
(
fact
.
value
)
hideDialog
()
}
else
{
validationError
.
text
=
errorString
forceSave
.
visible
=
true
}
}
}
}
}
...
@@ -80,14 +87,30 @@ QGCViewDialog {
...
@@ -80,14 +87,30 @@ QGCViewDialog {
}
}
QGCTextField
{
QGCTextField
{
id
:
valueField
id
:
valueField
text
:
validate
?
validateValue
:
fact
.
valueString
text
:
validate
?
validateValue
:
fact
.
valueString
visible
:
fact
.
enumStrings
.
length
==
0
||
validate
//focus: true
//focus: true
// At this point all Facts are numeric
// At this point all Facts are numeric
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
inputMethodHints
:
Qt
.
ImhFormattedNumbersOnly
}
}
QGCComboBox
{
id
:
factCombo
width
:
valueField
.
width
visible
:
fact
.
enumStrings
.
length
!=
0
&&
!
validate
model
:
fact
.
enumStrings
Component.onCompleted
:
{
// We can't bind directly to fact.enumIndex since that would add an unknown value
// if there are no enum strings.
if
(
visible
)
{
currentIndex
=
fact
.
enumIndex
}
}
}
QGCLabel
{
text
:
fact
.
name
}
QGCLabel
{
text
:
fact
.
name
}
Row
{
Row
{
...
...
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