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
18138fbb
Commit
18138fbb
authored
Nov 16, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for filter list
This allows you to filter the list of parameters the widget displays.
parent
28e1ad82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
9 deletions
+35
-9
QGCParamWidget.cc
src/ui/QGCParamWidget.cc
+29
-9
QGCParamWidget.h
src/ui/QGCParamWidget.h
+6
-0
No files found.
src/ui/QGCParamWidget.cc
View file @
18138fbb
...
...
@@ -206,15 +206,17 @@ void QGCParamWidget::handlePendingParamUpdate(int compId, const QString& paramNa
}
QTreeWidgetItem
*
paramItem
=
updateParameterDisplay
(
compId
,
paramName
,
value
);
if
(
isPending
)
{
paramItem
->
setBackground
(
0
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
paramItem
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
//ensure that the adjusted item is visible
tree
->
expandItem
(
paramItem
->
parent
());
}
else
{
paramItem
->
setBackground
(
0
,
Qt
::
NoBrush
);
paramItem
->
setBackground
(
1
,
Qt
::
NoBrush
);
if
(
paramItem
)
{
if
(
isPending
)
{
paramItem
->
setBackground
(
0
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
paramItem
->
setBackground
(
1
,
QBrush
(
QColor
(
QGC
::
colorOrange
)));
//ensure that the adjusted item is visible
tree
->
expandItem
(
paramItem
->
parent
());
}
else
{
paramItem
->
setBackground
(
0
,
Qt
::
NoBrush
);
paramItem
->
setBackground
(
1
,
Qt
::
NoBrush
);
}
}
updatingParamNameLock
.
clear
();
...
...
@@ -348,6 +350,24 @@ void QGCParamWidget::insertParamAlphabetical(int indexLowerBound, int indexUpper
QTreeWidgetItem
*
QGCParamWidget
::
updateParameterDisplay
(
int
compId
,
QString
parameterName
,
QVariant
value
)
{
//qDebug() << "QGCParamWidget::updateParameterDisplay" << parameterName;
// Filter the parameters according to the filter list
if
(
_filterList
.
count
()
!=
0
)
{
bool
filterFound
=
false
;
foreach
(
QString
paramFilter
,
_filterList
)
{
if
(
paramFilter
.
endsWith
(
"*"
)
&&
parameterName
.
startsWith
(
paramFilter
.
left
(
paramFilter
.
size
()
-
1
)))
{
filterFound
=
true
;
break
;
}
if
(
paramFilter
==
parameterName
)
{
filterFound
=
true
;
break
;
}
}
if
(
!
filterFound
)
{
return
NULL
;
}
}
// Reference to item in tree
QTreeWidgetItem
*
paramItem
=
NULL
;
...
...
src/ui/QGCParamWidget.h
View file @
18138fbb
...
...
@@ -52,6 +52,11 @@ class QGCParamWidget : public QGCBaseParamWidget
Q_OBJECT
public:
QGCParamWidget
(
QWidget
*
parent
=
0
);
/// @brief Sets the list of parameters which should be shown by this editor. Parameter names can be
/// wildcarded at the end such as this: "RC*". Which will filter to all parameters which begin
/// with "RC". The wildcard (*) can only be at the end of the string.
void
setFilterList
(
const
QStringList
&
filterList
)
{
_filterList
=
filterList
;
}
protected:
virtual
void
setParameterStatusMsg
(
const
QString
&
msg
);
...
...
@@ -98,6 +103,7 @@ protected:
QMap
<
int
,
QMap
<
QString
,
QTreeWidgetItem
*>*
>
paramGroups
;
///< Parameter groups to organize component items
QLabel
*
statusLabel
;
///< User-facing parameter status label
QTreeWidget
*
tree
;
///< The parameter tree
QStringList
_filterList
;
};
...
...
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