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
10e1b31e
Commit
10e1b31e
authored
Jul 19, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parameter search is now typedown style
Rewrote editor to be performant enough to support typedown
parent
478b0edd
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
194 additions
and
248 deletions
+194
-248
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+122
-220
ParameterEditorController.cc
src/QmlControls/ParameterEditorController.cc
+52
-23
ParameterEditorController.h
src/QmlControls/ParameterEditorController.h
+18
-3
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+1
-1
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+1
-1
No files found.
src/QmlControls/ParameterEditor.qml
View file @
10e1b31e
...
@@ -32,9 +32,8 @@ QGCView {
...
@@ -32,9 +32,8 @@ QGCView {
property
Fact
_editorDialogFact
:
Fact
{
}
property
Fact
_editorDialogFact
:
Fact
{
}
property
int
_rowHeight
:
ScreenTools
.
defaultFontPixelHeight
*
2
property
int
_rowHeight
:
ScreenTools
.
defaultFontPixelHeight
*
2
property
int
_rowWidth
:
10
// Dynamic adjusted at runtime
property
int
_rowWidth
:
10
// Dynamic adjusted at runtime
property
bool
_searchFilter
:
false
///< true: showing results of search
property
bool
_searchFilter
:
searchText
.
text
!=
""
///< true: showing results of search
property
var
_searchResults
///< List of parameter names from search results
property
var
_searchResults
///< List of parameter names from search results
property
string
_currentGroup
:
""
property
bool
_showRCToParam
:
!
ScreenTools
.
isMobile
&&
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
px4Firmware
property
bool
_showRCToParam
:
!
ScreenTools
.
isMobile
&&
QGroundControl
.
multiVehicleManager
.
activeVehicle
.
px4Firmware
ParameterEditorController
{
ParameterEditorController
{
...
@@ -55,34 +54,24 @@ QGCView {
...
@@ -55,34 +54,24 @@ QGCView {
id
:
header
id
:
header
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
height
:
searchText
.
height
+
ScreenTools
.
defaultFontPixelHeight
/
3
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCTextField
{
QGCLabel
{
id
:
searchText
anchors.baseline
:
clearButton
.
baseline
text
:
qsTr
(
"
Search:
"
)
}
}
QGCButton
{
QGCTextField
{
anchors.top
:
searchText
.
top
id
:
searchText
anchors.bottom
:
searchText
.
bottom
anchors.baseline
:
clearButton
.
baseline
text
:
qsTr
(
"
Search
"
)
text
:
controller
.
searchText
onClicked
:
{
onDisplayTextChanged
:
controller
.
searchText
=
displayText
_searchResults
=
controller
.
searchParametersForComponent
(
-
1
,
searchText
.
text
)
_searchFilter
=
true
}
}
}
QGCButton
{
QGCButton
{
anchors.top
:
searchText
.
top
id
:
clearButton
anchors.bottom
:
searchText
.
bottom
text
:
qsTr
(
"
Clear
"
)
text
:
qsTr
(
"
Clear
"
)
onClicked
:
searchText
.
text
=
""
visible
:
_searchFilter
onClicked
:
{
searchText
.
text
=
""
_searchFilter
=
false
hideDialog
()
}
}
}
}
// Row - Header
}
// Row - Header
...
@@ -132,184 +121,135 @@ QGCView {
...
@@ -132,184 +121,135 @@ QGCView {
}
}
}
}
//---------------------------------------------
/// Group buttons
//-- Contents
QGCFlickable
{
Loader
{
id
:
groupScroll
anchors.left
:
parent
.
left
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
anchors.right
:
parent
.
right
anchors.top
:
header
.
bottom
anchors.top
:
header
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
sourceComponent
:
_searchFilter
?
searchResultsViewComponent
:
groupedViewComponent
clip
:
true
}
pixelAligned
:
true
}
contentHeight
:
groupedViewComponentColumn
.
height
contentWidth
:
groupedViewComponentColumn
.
width
flickableDirection
:
Flickable
.
VerticalFlick
visible
:
!
_searchFilter
//-- Parameter Groups
Column
{
Component
{
id
:
groupedViewComponentColumn
id
:
groupedViewComponent
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
Repeater
{
//-- Parameter Groups
model
:
controller
.
componentIds
QGCFlickable
{
id
:
groupScroll
Column
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
id
:
componentColumn
height
:
parent
.
height
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
clip
:
true
pixelAligned
:
true
readonly
property
int
componentId
:
modelData
contentHeight
:
groupedViewComponentColumn
.
height
contentWidth
:
groupedViewComponentColumn
.
width
QGCLabel
{
flickableDirection
:
Flickable
.
VerticalFlick
text
:
qsTr
(
"
Component #: %1
"
).
arg
(
componentId
.
toString
())
Column
{
font.family
:
ScreenTools
.
demiboldFontFamily
id
:
groupedViewComponentColumn
anchors.horizontalCenter
:
parent
.
horizontalCenter
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
}
Repeater
{
model
:
controller
.
componentIds
ExclusiveGroup
{
id
:
groupGroup
}
Column
{
id
:
componentColumn
Repeater
{
readonly
property
int
componentId
:
parseInt
(
modelData
)
model
:
controller
.
getGroupsForComponent
(
componentId
)
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
QGCLabel
{
QGCButton
{
text
:
qsTr
(
"
Component #: %1
"
).
arg
(
componentId
.
toString
())
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
font.family
:
ScreenTools
.
demiboldFontFamily
text
:
groupName
anchors.horizontalCenter
:
parent
.
horizontalCenter
height
:
_rowHeight
}
exclusiveGroup
:
setupButtonGroup
ExclusiveGroup
{
id
:
groupGroup
}
Repeater
{
readonly
property
string
groupName
:
modelData
model
:
controller
.
getGroupsForComponent
(
componentId
)
QGCButton
{
onClicked
:
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
checked
=
true
text
:
modelData
_rowWidth
=
10
height
:
_rowHeight
controller
.
currentComponentId
=
componentId
exclusiveGroup
:
setupButtonGroup
controller
.
currentGroup
=
groupName
onClicked
:
{
checked
=
true
// Clear the rows from the component first. This allows us to change the componentId without
// breaking any bindings.
factRowsLoader
.
parameterNames
=
[
]
_rowWidth
=
10
factRowsLoader
.
componentId
=
componentId
factRowsLoader
.
parameterNames
=
controller
.
getParametersForGroup
(
componentId
,
modelData
)
_currentGroup
=
modelData
factScrollView
.
contentX
=
0
factScrollView
.
contentY
=
0
}
}
}
}
}
}
}
}
}
}
}
}
}
Rectangle
{
color
:
__qgcPal
.
text
width
:
1
height
:
parent
.
height
opacity
:
0.1
}
//-- Parameters
QGCFlickable
{
id
:
factScrollView
width
:
parent
.
width
-
groupScroll
.
width
height
:
parent
.
height
contentHeight
:
factRowsLoader
.
height
contentWidth
:
_rowWidth
boundsBehavior
:
Flickable
.
OvershootBounds
pixelAligned
:
true
clip
:
true
Loader
{
id
:
factRowsLoader
sourceComponent
:
factRowsComponent
property
int
componentId
:
controller
.
componentIds
[
0
]
property
var
parameterNames
:
controller
.
getParametersForGroup
(
componentId
,
controller
.
getGroupsForComponent
(
componentId
)[
0
])
onLoaded
:
{
_currentGroup
=
controller
.
getGroupsForComponent
(
controller
.
componentIds
[
0
])[
0
]
}
}
}
}
}
}
//---------------------------------------------
/// Parameter list
// Search result view
ListView
{
Component
{
id
:
editorListView
id
:
searchResultsViewComponent
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
Item
{
anchors.left
:
_searchFilter
?
parent
.
left
:
groupScroll
.
right
QGCFlickable
{
anchors.right
:
parent
.
right
id
:
factScrollView
anchors.top
:
header
.
bottom
width
:
parent
.
width
anchors.bottom
:
parent
.
bottom
height
:
parent
.
height
orientation
:
ListView
.
Vertical
contentHeight
:
factRowsLoader
.
height
model
:
controller
.
parameters
contentWidth
:
_rowWidth
cacheBuffer
:
height
>
0
?
height
*
2
:
0
boundsBehavior
:
Flickable
.
OvershootBounds
clip
:
true
pixelAligned
:
true
clip
:
true
delegate
:
Rectangle
{
Loader
{
height
:
_rowHeight
id
:
factRowsLoader
width
:
_rowWidth
sourceComponent
:
factRowsComponent
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
property
int
componentId
:
-
1
property
var
parameterNames
:
_searchResults
Row
{
}
id
:
factRow
}
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelWidth
*
0.5
)
}
anchors.verticalCenter
:
parent
.
verticalCenter
}
property
Fact
modelFact
:
object
QGCLabel
{
id
:
nameLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
text
:
factRow
.
modelFact
.
name
clip
:
true
}
//---------------------------------------------
QGCLabel
{
// Paremeters view
id
:
valueLabel
Component
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
id
:
factRowsComponent
color
:
factRow
.
modelFact
.
defaultValueAvailable
?
(
factRow
.
modelFact
.
valueEqualsDefault
?
__qgcPal
.
text
:
__qgcPal
.
warningText
)
:
__qgcPal
.
text
Column
{
text
:
factRow
.
modelFact
.
enumStrings
.
length
==
0
?
factRow
.
modelFact
.
valueString
+
"
"
+
factRow
.
modelFact
.
units
:
factRow
.
modelFact
.
enumStringValue
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
clip
:
true
Repeater
{
model
:
parameterNames
Rectangle
{
height
:
_rowHeight
width
:
_rowWidth
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
Row
{
id
:
factRow
property
Fact
modelFact
:
controller
.
getParameterFact
(
componentId
,
modelData
)
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelWidth
*
0.5
)
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
id
:
nameLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
text
:
factRow
.
modelFact
.
name
clip
:
true
}
QGCLabel
{
id
:
valueLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
color
:
factRow
.
modelFact
.
defaultValueAvailable
?
(
factRow
.
modelFact
.
valueEqualsDefault
?
__qgcPal
.
text
:
__qgcPal
.
warningText
)
:
__qgcPal
.
text
text
:
factRow
.
modelFact
.
enumStrings
.
length
==
0
?
factRow
.
modelFact
.
valueString
+
"
"
+
factRow
.
modelFact
.
units
:
factRow
.
modelFact
.
enumStringValue
clip
:
true
}
QGCLabel
{
text
:
factRow
.
modelFact
.
shortDescription
}
Component.onCompleted
:
{
if
(
_rowWidth
<
factRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
)
{
_rowWidth
=
factRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
}
}
}
}
Rectangle
{
width
:
_rowWidth
QGCLabel
{
height
:
1
text
:
factRow
.
modelFact
.
shortDescription
color
:
__qgcPal
.
text
opacity
:
0.15
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
}
}
MouseArea
{
anchors.fill
:
parent
Component.onCompleted
:
{
acceptedButtons
:
Qt
.
LeftButton
if
(
_rowWidth
<
factRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
)
{
onClicked
:
{
_rowWidth
=
factRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
_editorDialogFact
=
factRow
.
modelFact
showDialog
(
editorDialogComponent
,
qsTr
(
"
Parameter Editor
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Save
)
}
}
}
}
}
}
Rectangle
{
width
:
_rowWidth
height
:
1
color
:
__qgcPal
.
text
opacity
:
0.15
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
_editorDialogFact
=
factRow
.
modelFact
showDialog
(
editorDialogComponent
,
qsTr
(
"
Parameter Editor
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Save
)
}
}
}
}
}
}
}
}
// QGCViewPanel
Component
{
Component
{
id
:
editorDialogComponent
id
:
editorDialogComponent
...
@@ -320,44 +260,6 @@ QGCView {
...
@@ -320,44 +260,6 @@ QGCView {
}
}
}
}
Component
{
id
:
searchDialogComponent
QGCViewDialog
{
function
accept
()
{
_searchResults
=
controller
.
searchParametersForComponent
(
-
1
,
searchFor
.
text
,
true
/*searchInName.checked*/
,
true
/*searchInDescriptions.checked*/
)
_searchFilter
=
true
hideDialog
()
}
function
reject
()
{
_searchFilter
=
false
hideDialog
()
}
QGCLabel
{
id
:
searchForLabel
text
:
qsTr
(
"
Search for:
"
)
}
QGCTextField
{
id
:
searchFor
anchors.topMargin
:
defaultTextHeight
/
3
anchors.top
:
searchForLabel
.
bottom
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
}
QGCLabel
{
anchors.topMargin
:
defaultTextHeight
anchors.top
:
searchFor
.
bottom
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
Hint: Leave 'Search For' blank and click Apply to list all parameters sorted by name.
"
)
}
}
}
Component
{
Component
{
id
:
mobileFilePicker
id
:
mobileFilePicker
...
...
src/QmlControls/ParameterEditorController.cc
View file @
10e1b31e
...
@@ -25,14 +25,20 @@
...
@@ -25,14 +25,20 @@
/// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens.
/// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens.
ParameterEditorController
::
ParameterEditorController
(
void
)
ParameterEditorController
::
ParameterEditorController
(
void
)
:
_currentComponentId
(
_vehicle
->
defaultComponentId
())
,
_parameters
(
new
QmlObjectListModel
(
this
))
{
{
if
(
_autopilot
)
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
foreach
(
int
componentId
,
groupMap
.
keys
())
{
_componentIds
+=
QString
(
"%1"
).
arg
(
componentId
);
foreach
(
int
componentId
,
groupMap
.
keys
())
{
_componentIds
+=
QString
(
"%1"
).
arg
(
componentId
);
}
}
}
_currentGroup
=
groupMap
[
_currentComponentId
].
keys
()[
0
];
_updateParameters
();
connect
(
this
,
&
ParameterEditorController
::
searchTextChanged
,
this
,
&
ParameterEditorController
::
_updateParameters
);
connect
(
this
,
&
ParameterEditorController
::
currentComponentIdChanged
,
this
,
&
ParameterEditorController
::
_updateParameters
);
connect
(
this
,
&
ParameterEditorController
::
currentGroupChanged
,
this
,
&
ParameterEditorController
::
_updateParameters
);
}
}
ParameterEditorController
::~
ParameterEditorController
()
ParameterEditorController
::~
ParameterEditorController
()
...
@@ -42,16 +48,16 @@ ParameterEditorController::~ParameterEditorController()
...
@@ -42,16 +48,16 @@ ParameterEditorController::~ParameterEditorController()
QStringList
ParameterEditorController
::
getGroupsForComponent
(
int
componentId
)
QStringList
ParameterEditorController
::
getGroupsForComponent
(
int
componentId
)
{
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
return
groupMap
[
componentId
].
keys
();
return
groupMap
[
componentId
].
keys
();
}
}
QStringList
ParameterEditorController
::
getParametersForGroup
(
int
componentId
,
QString
group
)
QStringList
ParameterEditorController
::
getParametersForGroup
(
int
componentId
,
QString
group
)
{
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
return
groupMap
[
componentId
][
group
];
return
groupMap
[
componentId
][
group
];
}
}
QStringList
ParameterEditorController
::
searchParametersForComponent
(
int
componentId
,
const
QString
&
searchText
,
bool
searchInName
,
bool
searchInDescriptions
)
QStringList
ParameterEditorController
::
searchParametersForComponent
(
int
componentId
,
const
QString
&
searchText
,
bool
searchInName
,
bool
searchInDescriptions
)
...
@@ -78,8 +84,8 @@ QStringList ParameterEditorController::searchParametersForComponent(int componen
...
@@ -78,8 +84,8 @@ QStringList ParameterEditorController::searchParametersForComponent(int componen
void
ParameterEditorController
::
clearRCToParam
(
void
)
void
ParameterEditorController
::
clearRCToParam
(
void
)
{
{
Q_ASSERT
(
_uas
);
Q_ASSERT
(
_uas
);
_uas
->
unsetRCToParameterMap
();
_uas
->
unsetRCToParameterMap
();
}
}
void
ParameterEditorController
::
saveToFile
(
const
QString
&
filename
)
void
ParameterEditorController
::
saveToFile
(
const
QString
&
filename
)
...
@@ -92,15 +98,15 @@ void ParameterEditorController::saveToFile(const QString& filename)
...
@@ -92,15 +98,15 @@ void ParameterEditorController::saveToFile(const QString& filename)
if
(
!
filename
.
isEmpty
())
{
if
(
!
filename
.
isEmpty
())
{
QFile
file
(
filename
);
QFile
file
(
filename
);
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
if
(
!
file
.
open
(
QIODevice
::
WriteOnly
|
QIODevice
::
Text
))
{
qgcApp
()
->
showMessage
(
QString
(
"Unable to create file: %1"
).
arg
(
filename
));
qgcApp
()
->
showMessage
(
QString
(
"Unable to create file: %1"
).
arg
(
filename
));
return
;
return
;
}
}
QTextStream
stream
(
&
file
);
QTextStream
stream
(
&
file
);
_autopilot
->
writeParametersToStream
(
stream
);
_autopilot
->
writeParametersToStream
(
stream
);
file
.
close
();
file
.
close
();
}
}
}
}
void
ParameterEditorController
::
saveToFilePicker
(
void
)
void
ParameterEditorController
::
saveToFilePicker
(
void
)
...
@@ -156,7 +162,7 @@ void ParameterEditorController::loadFromFilePicker(void)
...
@@ -156,7 +162,7 @@ void ParameterEditorController::loadFromFilePicker(void)
void
ParameterEditorController
::
refresh
(
void
)
void
ParameterEditorController
::
refresh
(
void
)
{
{
_autopilot
->
refreshAllParameters
();
_autopilot
->
refreshAllParameters
();
}
}
void
ParameterEditorController
::
resetAllToDefaults
(
void
)
void
ParameterEditorController
::
resetAllToDefaults
(
void
)
...
@@ -170,8 +176,31 @@ void ParameterEditorController::setRCToParam(const QString& paramName)
...
@@ -170,8 +176,31 @@ void ParameterEditorController::setRCToParam(const QString& paramName)
#ifdef __mobile__
#ifdef __mobile__
Q_UNUSED
(
paramName
)
Q_UNUSED
(
paramName
)
#else
#else
Q_ASSERT
(
_uas
);
Q_ASSERT
(
_uas
);
QGCMapRCToParamDialog
*
d
=
new
QGCMapRCToParamDialog
(
paramName
,
_uas
,
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
MainWindow
::
instance
());
QGCMapRCToParamDialog
*
d
=
new
QGCMapRCToParamDialog
(
paramName
,
_uas
,
qgcApp
()
->
toolbox
()
->
multiVehicleManager
(),
MainWindow
::
instance
());
d
->
exec
();
d
->
exec
();
#endif
#endif
}
}
void
ParameterEditorController
::
_updateParameters
(
void
)
{
QObjectList
newParameterList
;
if
(
_searchText
.
isEmpty
())
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
foreach
(
const
QString
&
parameter
,
groupMap
[
_currentComponentId
][
_currentGroup
])
{
newParameterList
.
append
(
_autopilot
->
getParameterFact
(
_currentComponentId
,
parameter
));
}
}
else
{
foreach
(
const
QString
&
parameter
,
_autopilot
->
parameterNames
(
_vehicle
->
defaultComponentId
()))
{
Fact
*
fact
=
_autopilot
->
getParameterFact
(
_vehicle
->
defaultComponentId
(),
parameter
);
if
(
fact
->
name
().
contains
(
_searchText
,
Qt
::
CaseInsensitive
)
||
fact
->
shortDescription
().
contains
(
_searchText
,
Qt
::
CaseInsensitive
)
||
fact
->
longDescription
().
contains
(
_searchText
,
Qt
::
CaseInsensitive
))
{
newParameterList
.
append
(
fact
);
}
}
}
_parameters
->
swapObjectList
(
newParameterList
);
}
src/QmlControls/ParameterEditorController.h
View file @
10e1b31e
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "AutoPilotPlugin.h"
#include "AutoPilotPlugin.h"
#include "UASInterface.h"
#include "UASInterface.h"
#include "FactPanelController.h"
#include "FactPanelController.h"
#include "QmlObjectListModel.h"
class
ParameterEditorController
:
public
FactPanelController
class
ParameterEditorController
:
public
FactPanelController
{
{
...
@@ -29,7 +30,11 @@ public:
...
@@ -29,7 +30,11 @@ public:
ParameterEditorController
(
void
);
ParameterEditorController
(
void
);
~
ParameterEditorController
();
~
ParameterEditorController
();
Q_PROPERTY
(
QStringList
componentIds
MEMBER
_componentIds
CONSTANT
)
Q_PROPERTY
(
QString
searchText
MEMBER
_searchText
NOTIFY
searchTextChanged
)
Q_PROPERTY
(
int
currentComponentId
MEMBER
_currentComponentId
NOTIFY
currentComponentIdChanged
)
Q_PROPERTY
(
QString
currentGroup
MEMBER
_currentGroup
NOTIFY
currentGroupChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
parameters
MEMBER
_parameters
CONSTANT
)
Q_PROPERTY
(
QVariantList
componentIds
MEMBER
_componentIds
CONSTANT
)
Q_INVOKABLE
QStringList
getGroupsForComponent
(
int
componentId
);
Q_INVOKABLE
QStringList
getGroupsForComponent
(
int
componentId
);
Q_INVOKABLE
QStringList
getParametersForGroup
(
int
componentId
,
QString
group
);
Q_INVOKABLE
QStringList
getParametersForGroup
(
int
componentId
,
QString
group
);
...
@@ -47,10 +52,20 @@ public:
...
@@ -47,10 +52,20 @@ public:
QList
<
QObject
*>
model
(
void
);
QList
<
QObject
*>
model
(
void
);
signals:
signals:
void
searchTextChanged
(
QString
searchText
);
void
currentComponentIdChanged
(
int
componentId
);
void
currentGroupChanged
(
QString
group
);
void
showErrorMessage
(
const
QString
&
errorMsg
);
void
showErrorMessage
(
const
QString
&
errorMsg
);
private
slots
:
void
_updateParameters
(
void
);
private:
private:
QStringList
_componentIds
;
QVariantList
_componentIds
;
QString
_searchText
;
int
_currentComponentId
;
QString
_currentGroup
;
QmlObjectListModel
*
_parameters
;
};
};
#endif
#endif
src/QmlControls/QmlObjectListModel.cc
View file @
10e1b31e
...
@@ -179,7 +179,7 @@ void QmlObjectListModel::append(QObject* object)
...
@@ -179,7 +179,7 @@ void QmlObjectListModel::append(QObject* object)
insert
(
_objectList
.
count
(),
object
);
insert
(
_objectList
.
count
(),
object
);
}
}
QObjectList
QmlObjectListModel
::
swapObjectList
(
QObjectList
newlist
)
QObjectList
QmlObjectListModel
::
swapObjectList
(
const
QObjectList
&
newlist
)
{
{
QObjectList
oldlist
(
_objectList
);
QObjectList
oldlist
(
_objectList
);
beginResetModel
();
beginResetModel
();
...
...
src/QmlControls/QmlObjectListModel.h
View file @
10e1b31e
...
@@ -37,7 +37,7 @@ public:
...
@@ -37,7 +37,7 @@ public:
void
setDirty
(
bool
dirty
);
void
setDirty
(
bool
dirty
);
void
append
(
QObject
*
object
);
void
append
(
QObject
*
object
);
QObjectList
swapObjectList
(
QObjectList
newlist
);
QObjectList
swapObjectList
(
const
QObjectList
&
newlist
);
void
clear
(
void
);
void
clear
(
void
);
QObject
*
removeAt
(
int
i
);
QObject
*
removeAt
(
int
i
);
QObject
*
removeOne
(
QObject
*
object
)
{
return
removeAt
(
indexOf
(
object
));
}
QObject
*
removeOne
(
QObject
*
object
)
{
return
removeAt
(
indexOf
(
object
));
}
...
...
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