Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
7eae3b29
Commit
7eae3b29
authored
Sep 20, 2016
by
Don Gagne
Committed by
GitHub
Sep 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4062 from DonLakeFlyer/TFHelp
Show help button on FactTextFields
parents
6d8385ed
0ea45f38
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
36 deletions
+87
-36
FactTextField.qml
src/FactSystem/FactControls/FactTextField.qml
+14
-2
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+2
-2
FactMetaData.h
src/FactSystem/FactMetaData.h
+2
-1
ParameterEditorDialog.qml
src/QmlControls/ParameterEditorDialog.qml
+7
-3
QGCTextField.qml
src/QmlControls/QGCTextField.qml
+62
-28
No files found.
src/FactSystem/FactControls/FactTextField.qml
View file @
7eae3b29
...
...
@@ -14,6 +14,7 @@ QGCTextField {
text
:
fact
?
fact
.
valueString
:
""
unitsLabel
:
fact
?
fact
.
units
:
""
showUnits
:
true
showHelp
:
true
property
Fact
fact
:
null
property
string
_validateString
...
...
@@ -31,7 +32,7 @@ QGCTextField {
fact
.
value
=
text
}
else
{
_validateString
=
text
qgcView
.
showDialog
(
editorDialogComponent
,
qsTr
(
"
Invalid Parameter
Value
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Save
)
qgcView
.
showDialog
(
validationErrorDialogComponent
,
qsTr
(
"
Invalid
Value
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Save
)
}
}
else
{
fact
.
value
=
text
...
...
@@ -39,8 +40,11 @@ QGCTextField {
}
}
onHelpClicked
:
qgcView
.
showDialog
(
helpDialogComponent
,
qsTr
(
"
Value Details
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Save
)
Component
{
id
:
edit
orDialogComponent
id
:
validationErr
orDialogComponent
ParameterEditorDialog
{
validate
:
true
...
...
@@ -48,4 +52,12 @@ QGCTextField {
fact
:
_textField
.
fact
}
}
Component
{
id
:
helpDialogComponent
ParameterEditorDialog
{
fact
:
_textField
.
fact
}
}
}
src/FactSystem/FactMetaData.cc
View file @
7eae3b29
...
...
@@ -750,7 +750,7 @@ int FactMetaData::decimalPlaces(void) const
return
actualDecimalPlaces
;
}
FactMetaData
*
FactMetaData
::
_
createFromJsonObject
(
const
QJsonObject
&
json
,
QObject
*
metaDataParent
)
FactMetaData
*
FactMetaData
::
createFromJsonObject
(
const
QJsonObject
&
json
,
QObject
*
metaDataParent
)
{
QString
errorString
;
...
...
@@ -855,7 +855,7 @@ QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonFile(const QString&
continue
;
}
QJsonObject
jsonObject
=
jsonValue
.
toObject
();
FactMetaData
*
metaData
=
_
createFromJsonObject
(
jsonObject
,
metaDataParent
);
FactMetaData
*
metaData
=
createFromJsonObject
(
jsonObject
,
metaDataParent
);
if
(
metaDataMap
.
contains
(
metaData
->
name
()))
{
qWarning
()
<<
QStringLiteral
(
"Duplicate fact name:"
)
<<
metaData
->
name
();
...
...
src/FactSystem/FactMetaData.h
View file @
7eae3b29
...
...
@@ -48,6 +48,8 @@ public:
static
QMap
<
QString
,
FactMetaData
*>
createMapFromJsonFile
(
const
QString
&
jsonFilename
,
QObject
*
metaDataParent
);
static
FactMetaData
*
createFromJsonObject
(
const
QJsonObject
&
json
,
QObject
*
metaDataParent
);
const
FactMetaData
&
operator
=
(
const
FactMetaData
&
other
);
/// Converts from meters to the user specified distance unit
...
...
@@ -144,7 +146,6 @@ private:
QVariant
_minForType
(
void
)
const
;
QVariant
_maxForType
(
void
)
const
;
void
_setAppSettingsTranslators
(
void
);
static
FactMetaData
*
_createFromJsonObject
(
const
QJsonObject
&
json
,
QObject
*
metaDataParent
);
// Built in translators
static
QVariant
_defaultTranslator
(
const
QVariant
&
from
)
{
return
from
;
}
...
...
src/QmlControls/ParameterEditorDialog.qml
View file @
7eae3b29
...
...
@@ -85,7 +85,8 @@ QGCViewDialog {
QGCLabel
{
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
text
:
fact
.
shortDescription
?
fact
.
shortDescription
:
qsTr
(
"
Parameter Description (not defined)
"
)
visible
:
fact
.
shortDescription
text
:
fact
.
shortDescription
}
QGCLabel
{
...
...
@@ -156,7 +157,10 @@ QGCViewDialog {
}
}
QGCLabel
{
text
:
fact
.
name
}
QGCLabel
{
text
:
fact
.
name
visible
:
fact
.
componentId
>
0
// > 0 means it's a parameter fact
}
Column
{
spacing
:
defaultTextHeight
/
2
...
...
@@ -202,7 +206,7 @@ QGCViewDialog {
QGCLabel
{
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
Warning: Modifying
parameter
s while vehicle is in flight can lead to vehicle instability and possible vehicle loss.
"
)
+
text
:
qsTr
(
"
Warning: Modifying
value
s while vehicle is in flight can lead to vehicle instability and possible vehicle loss.
"
)
+
qsTr
(
"
Make sure you know what you are doing and double-check your values before Save!
"
)
}
...
...
src/QmlControls/QGCTextField.qml
View file @
7eae3b29
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QtQuick
.
Layouts
1.2
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
TextField
{
id
:
root
property
bool
showUnits
:
false
property
bool
showUnits
:
false
property
bool
showHelp
:
false
property
string
unitsLabel
:
""
signal
helpClicked
property
real
_helpLayoutWidth
:
0
Component.onCompleted
:
{
if
(
typeof
qgcTextFieldforwardKeysTo
!==
'
undefined
'
)
{
root
.
Keys
.
forwardTo
=
[
qgcTextFieldforwardKeysTo
]
}
}
property
var
__qgcPal
:
QGCPalette
{
colorGroupEnabled
:
enabled
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
textColor
:
__
qgcPal
.
textFieldText
textColor
:
qgcPal
.
textFieldText
height
:
Math
.
round
(
Math
.
max
(
25
,
ScreenTools
.
defaultFontPixelHeight
*
(
ScreenTools
.
isMobile
?
2.5
:
1.2
)))
QGCLabel
{
...
...
@@ -35,6 +41,8 @@ TextField {
background
:
Item
{
id
:
backgroundItem
property
bool
showHelp
:
control
.
showHelp
&&
control
.
activeFocus
Rectangle
{
anchors.fill
:
parent
anchors.bottomMargin
:
-
1
...
...
@@ -44,32 +52,58 @@ TextField {
Rectangle
{
anchors.fill
:
parent
border.color
:
control
.
activeFocus
?
"
#47b
"
:
"
#999
"
color
:
__
qgcPal
.
textField
color
:
qgcPal
.
textField
}
Text
{
id
:
unitsLabel
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
verticalAlignment
:
Text
.
AlignVCenter
horizontalAlignment
:
Text
.
AlignHCenter
x
:
parent
.
width
-
width
width
:
unitsLabelWidthGenerator
.
width
text
:
control
.
unitsLabel
font.pointSize
:
ScreenTools
.
defaultFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
antialiasing
:
true
RowLayout
{
id
:
unitsHelpLayout
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.rightMargin
:
backgroundItem
.
showHelp
?
0
:
control
.
__contentHeight
*
0.333
anchors.right
:
parent
.
right
spacing
:
4
Component.onCompleted
:
control
.
_helpLayoutWidth
=
unitsHelpLayout
.
width
onWidthChanged
:
control
.
_helpLayoutWidth
=
unitsHelpLayout
.
width
Text
{
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
control
.
unitsLabel
font.pointSize
:
backgroundItem
.
showHelp
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
antialiasing
:
true
color
:
control
.
textColor
visible
:
control
.
showUnits
}
Rectangle
{
anchors.margins
:
2
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.right
:
parent
.
right
width
:
height
*
0.75
color
:
control
.
textColor
radius
:
2
visible
:
backgroundItem
.
showHelp
QGCLabel
{
anchors.fill
:
parent
verticalAlignment
:
Text
.
AlignVCenter
horizontalAlignment
:
Text
.
AlignHCenter
color
:
qgcPal
.
textField
text
:
"
?
"
}
}
}
color
:
control
.
textColor
visible
:
control
.
showUnits
MouseArea
{
anchors.fill
:
unitsHelpLayout
enabled
:
control
.
activeFocus
onClicked
:
root
.
helpClicked
()
}
}
padding.right
:
control
.
showUnits
?
unitsLabelWidthGenerator
.
width
:
control
.
__contentHeight
*
0.333
padding.right
:
control
.
_helpLayoutWidth
//control.
showUnits ? unitsLabelWidthGenerator.width : control.__contentHeight * 0.333
}
onActiveFocusChanged
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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