-
Notifications
You must be signed in to change notification settings - Fork 0
/
balaifrequenciel.cpp
62 lines (43 loc) · 1.38 KB
/
balaifrequenciel.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "balaifrequenciel.h"
#include "ui_balaifrequenciel.h"
#include <qwt/qwt_plot.h>
#include <qwt/qwt_plot_grid.h>
#include <qwt/qwt_plot_marker.h>
#include <qwt/qwt_plot_histogram.h>
#include <QtGlobal>
BalaiFrequenciel::BalaiFrequenciel(Serial *com_, QWidget *parent) :
QwtPlot(parent)
{
com = com_;
setAxisTitle( QwtPlot::yLeft, "Puissance" );
setAxisTitle( QwtPlot::xBottom, "Canal" );
QwtLegend *legend = new QwtLegend;
legend->setItemMode( QwtLegend::CheckableItem );
insertLegend( legend, QwtPlot::RightLegend );
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableX( false );
grid->enableY( true );
grid->enableXMin( false );
grid->enableYMin( false );
grid->setMajPen( QPen( Qt::black, 0, Qt::DotLine ) );
grid->attach(this );
histogram = new Histogram("",Qt::red);
histogram->attach(this);
replot();
connect(com, SIGNAL(balayageDone(QVector<double>)), this, SLOT(balayageDone(QVector<double>)));
startBalayage();
}
void BalaiFrequenciel::balayageDone(QVector<double> values) {
qDebug() << "Balai: " << values.size();
setData(values);
}
void BalaiFrequenciel::startBalayage() {
com->balayageFrequenciel();
}
void BalaiFrequenciel::setData(QVector<double> values) {
histogram->setValues(values.size(), &values.toStdVector()[0] );
replot();
}
BalaiFrequenciel::~BalaiFrequenciel()
{
}