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
bd9e85c9
Commit
bd9e85c9
authored
Oct 23, 2013
by
Thomas Gubler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic filter functionality
parent
8e3f46f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
2 deletions
+52
-2
LinechartWidget.cc
src/ui/linechart/LinechartWidget.cc
+45
-1
LinechartWidget.h
src/ui/linechart/LinechartWidget.h
+7
-1
No files found.
src/ui/linechart/LinechartWidget.cc
View file @
bd9e85c9
...
...
@@ -26,7 +26,7 @@ This file is part of the PIXHAWK project
* @brief Line chart plot widget
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*
@author Thomas Gubler <thomasgubler@student.ethz.ch>
*/
#include <QDebug>
...
...
@@ -105,6 +105,7 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent
connect
(
ui
.
recolorButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
recolor
()));
connect
(
ui
.
shortNameCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
setShortNames
(
bool
)));
connect
(
ui
.
plotFilterLineEdit
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
filterCurves
(
const
QString
&
)));
int
labelRow
=
curvesWidgetLayout
->
rowCount
();
...
...
@@ -564,6 +565,7 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit)
checkBox
->
setObjectName
(
curve
+
unit
);
checkBox
->
setToolTip
(
tr
(
"Enable the curve in the graph window"
));
checkBox
->
setWhatsThis
(
tr
(
"Enable the curve in the graph window"
));
checkBoxes
.
insert
(
curve
+
unit
,
checkBox
);
curvesWidgetLayout
->
addWidget
(
checkBox
,
labelRow
,
0
);
// Icon
...
...
@@ -593,6 +595,7 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit)
unitLabel
->
setText
(
unit
);
unitLabel
->
setToolTip
(
tr
(
"Unit of "
)
+
curve
);
unitLabel
->
setWhatsThis
(
tr
(
"Unit of "
)
+
curve
);
curveUnits
.
insert
(
curve
+
unit
,
unitLabel
);
curvesWidgetLayout
->
addWidget
(
unitLabel
,
labelRow
,
4
);
unitLabel
->
setVisible
(
ui
.
showUnitsCheckBox
->
isChecked
());
connect
(
ui
.
showUnitsCheckBox
,
SIGNAL
(
clicked
(
bool
)),
unitLabel
,
SLOT
(
setVisible
(
bool
)));
...
...
@@ -691,6 +694,47 @@ void LinechartWidget::recolor()
}
}
void
LinechartWidget
::
filterCurve
(
const
QString
&
key
,
bool
match
)
{
colorIcons
[
key
]
->
setVisible
(
match
);
curveNameLabels
[
key
]
->
setVisible
(
match
);
(
*
curveLabels
)[
key
]
->
setVisible
(
match
);
(
*
curveMeans
)[
key
]
->
setVisible
(
match
);
(
*
curveVariances
)[
key
]
->
setVisible
(
match
);
curveUnits
[
key
]
->
setVisible
(
match
);
checkBoxes
[
key
]
->
setVisible
(
match
);
}
void
LinechartWidget
::
filterCurves
(
const
QString
&
filter
)
{
//qDebug() << "filterCurves: filter: " << filter;
if
(
filter
!=
""
)
{
/* Hide Elements which do not match the filter pattern */
QStringMatcher
stringMatcher
(
filter
,
Qt
::
CaseInsensitive
);
foreach
(
QString
key
,
colorIcons
.
keys
())
{
if
(
stringMatcher
.
indexIn
(
key
)
<
0
)
{
filterCurve
(
key
,
false
);
}
else
{
filterCurve
(
key
,
true
);
}
}
}
else
{
/* Show all Elements */
foreach
(
QString
key
,
colorIcons
.
keys
())
{
filterCurve
(
key
,
true
);
}
}
}
QString
LinechartWidget
::
getCurveName
(
const
QString
&
key
,
bool
shortEnabled
)
{
if
(
shortEnabled
)
...
...
src/ui/linechart/LinechartWidget.h
View file @
bd9e85c9
...
...
@@ -26,7 +26,7 @@ This file is part of the PIXHAWK project
* @brief Definition of Line chart plot widget
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
*
*
@author Thomas Gubler <thomasgubler@student.ethz.ch>
*/
#ifndef LINECHARTWIDGET_H
#define LINECHARTWIDGET_H
...
...
@@ -79,6 +79,8 @@ public slots:
void
setShortNames
(
bool
enable
);
/** @brief Append data to the given curve. */
void
appendData
(
int
uasId
,
const
QString
&
curve
,
const
QString
&
unit
,
const
QVariant
&
value
,
quint64
usec
);
/** @brief Hide curves which do not match the filter pattern */
void
filterCurves
(
const
QString
&
filter
);
void
toggleLogarithmicScaling
(
bool
toggled
);
void
takeButtonClick
(
bool
checked
);
...
...
@@ -110,6 +112,8 @@ public slots:
private
slots
:
/** Called when the user changes the time scale combobox. */
void
timeScaleChanged
(
int
index
);
/** @brief Applies action on curve corresponding to key based on the bool match. I used to filter curves */
void
filterCurve
(
const
QString
&
key
,
bool
match
);
protected:
void
addCurveToList
(
QString
curve
);
...
...
@@ -132,9 +136,11 @@ protected:
QMap
<
QString
,
QString
>
curveNames
;
///< Full curve names
QMap
<
QString
,
QLabel
*>*
curveMeans
;
///< References to the curve means
QMap
<
QString
,
QLabel
*>*
curveMedians
;
///< References to the curve medians
QMap
<
QString
,
QWidget
*>
curveUnits
;
///< References to the curve units
QMap
<
QString
,
QLabel
*>*
curveVariances
;
///< References to the curve variances
QMap
<
QString
,
int
>
intData
;
///< Current values for integer-valued curves
QMap
<
QString
,
QWidget
*>
colorIcons
;
///< Reference to color icons
QMap
<
QString
,
QCheckBox
*>
checkBoxes
;
///< Reference to checkboxes
QWidget
*
curvesWidget
;
///< The QWidget containing the curve selection button
QGridLayout
*
curvesWidgetLayout
;
///< The layout for the curvesWidget QWidget
...
...
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