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
d937bd2b
Commit
d937bd2b
authored
Jul 19, 2016
by
Don Gagne
Committed by
GitHub
Jul 19, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3826 from DonLakeFlyer/ParamTypedown
Parameter search is now typedown style
parents
478b0edd
10e1b31e
Changes
5
Expand all
Show 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 @
d937bd2b
This diff is collapsed.
Click to expand it.
src/QmlControls/ParameterEditorController.cc
View file @
d937bd2b
...
...
@@ -25,14 +25,20 @@
/// @Brief Constructs a new ParameterEditorController Widget. This widget is used within the PX4VehicleConfig set of screens.
ParameterEditorController
::
ParameterEditorController
(
void
)
:
_currentComponentId
(
_vehicle
->
defaultComponentId
())
,
_parameters
(
new
QmlObjectListModel
(
this
))
{
if
(
_autopilot
)
{
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
groupMap
=
_autopilot
->
getGroupMap
();
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
()
...
...
@@ -175,3 +181,26 @@ void ParameterEditorController::setRCToParam(const QString& paramName)
d
->
exec
();
#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 @
d937bd2b
...
...
@@ -20,6 +20,7 @@
#include "AutoPilotPlugin.h"
#include "UASInterface.h"
#include "FactPanelController.h"
#include "QmlObjectListModel.h"
class
ParameterEditorController
:
public
FactPanelController
{
...
...
@@ -29,7 +30,11 @@ public:
ParameterEditorController
(
void
);
~
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
getParametersForGroup
(
int
componentId
,
QString
group
);
...
...
@@ -47,10 +52,20 @@ public:
QList
<
QObject
*>
model
(
void
);
signals:
void
searchTextChanged
(
QString
searchText
);
void
currentComponentIdChanged
(
int
componentId
);
void
currentGroupChanged
(
QString
group
);
void
showErrorMessage
(
const
QString
&
errorMsg
);
private
slots
:
void
_updateParameters
(
void
);
private:
QStringList
_componentIds
;
QVariantList
_componentIds
;
QString
_searchText
;
int
_currentComponentId
;
QString
_currentGroup
;
QmlObjectListModel
*
_parameters
;
};
#endif
src/QmlControls/QmlObjectListModel.cc
View file @
d937bd2b
...
...
@@ -179,7 +179,7 @@ void QmlObjectListModel::append(QObject* object)
insert
(
_objectList
.
count
(),
object
);
}
QObjectList
QmlObjectListModel
::
swapObjectList
(
QObjectList
newlist
)
QObjectList
QmlObjectListModel
::
swapObjectList
(
const
QObjectList
&
newlist
)
{
QObjectList
oldlist
(
_objectList
);
beginResetModel
();
...
...
src/QmlControls/QmlObjectListModel.h
View file @
d937bd2b
...
...
@@ -37,7 +37,7 @@ public:
void
setDirty
(
bool
dirty
);
void
append
(
QObject
*
object
);
QObjectList
swapObjectList
(
QObjectList
newlist
);
QObjectList
swapObjectList
(
const
QObjectList
&
newlist
);
void
clear
(
void
);
QObject
*
removeAt
(
int
i
);
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