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
eb8ac2b6
Commit
eb8ac2b6
authored
Oct 23, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #406 from thomasgubler/plotfilter
Filtering in plot perspective
parents
3668e9be
52d4181c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
4 deletions
+69
-4
Linechart.ui
src/ui/Linechart.ui
+9
-2
LinechartWidget.cc
src/ui/linechart/LinechartWidget.cc
+51
-1
LinechartWidget.h
src/ui/linechart/LinechartWidget.h
+9
-1
No files found.
src/ui/Linechart.ui
View file @
eb8ac2b6
...
...
@@ -47,7 +47,7 @@
<number>
10
</number>
</property>
<widget
class=
"QWidget"
name=
"curveGroupBox"
native=
"true"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"50,0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"50,0
,0,0
"
>
<property
name=
"leftMargin"
>
<number>
6
</number>
</property>
...
...
@@ -110,11 +110,18 @@
</widget>
</widget>
</item>
<item
row=
"
1
"
column=
"0"
>
<item
row=
"
3
"
column=
"0"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<property
name=
"spacing"
>
<number>
2
</number>
</property>
<item>
<widget
class=
"QLineEdit"
name=
"plotFilterLineEdit"
>
<property
name=
"placeholderText"
>
<string>
Filter... (Ctrl+F)
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"uasSelectionBox"
>
<item>
...
...
src/ui/linechart/LinechartWidget.cc
View file @
eb8ac2b6
...
...
@@ -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,8 @@ 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
&
)));
new
QShortcut
(
QKeySequence
(
Qt
::
CTRL
+
Qt
::
Key_F
),
this
,
SLOT
(
setPlotFilterLineEditFocus
()));
int
labelRow
=
curvesWidgetLayout
->
rowCount
();
...
...
@@ -564,6 +566,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 +596,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 +695,52 @@ void LinechartWidget::recolor()
}
}
void
LinechartWidget
::
setPlotFilterLineEditFocus
()
{
ui
.
plotFilterLineEdit
->
setFocus
(
Qt
::
ShortcutFocusReason
);
}
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 @
eb8ac2b6
...
...
@@ -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
);
...
...
@@ -106,10 +108,14 @@ public slots:
void
readSettings
();
/** @brief Select all curves */
void
selectAllCurves
(
bool
all
);
/** @brief Sets the focus to the LineEdit for plot-filtering */
void
setPlotFilterLineEditFocus
();
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 +138,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