-
Notifications
You must be signed in to change notification settings - Fork 14
/
PlotHolderWidget.cpp
44 lines (34 loc) · 1.27 KB
/
PlotHolderWidget.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
/*
* @author Fiachra & Tom
*/
#include "PlotHolderWidget.h"
PlotHolderWidget::PlotHolderWidget(QWidget* parent) : QWidget(parent) {
setWindowTitle("Plot Window");
mainLayout = new QVBoxLayout;
setLayout(mainLayout);
plotLength = new QSlider;
plotLength->setMinimum(50);
plotLength->setMaximum(10000);
plotLength->setOrientation(Qt::Horizontal);
mainLayout->addWidget(plotLength);
currentDataLength = new QLabel;
currentDataLength->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
currentDataLength->setText(
"Current Window Sample Length: " + QString::number(DataPlotWidget::kInitialPlotLength));
mainLayout->addWidget(currentDataLength);
plotLayout = new QVBoxLayout;
dataPlotWidget = new DataPlotWidget();
plotLayout->addWidget(dataPlotWidget);
mainLayout->addLayout(plotLayout);
connect(plotLength, SIGNAL(valueChanged(int)), this, SLOT(changeDataLength(int)));
}
void PlotHolderWidget::update(const std::vector<std::pair<std::string, float>>& plotVals) {
dataPlotWidget->updatePlot(plotVals);
}
void PlotHolderWidget::changeDataLength(int len) {
dataPlotWidget->setDataLength(len);
currentDataLength->setText("Current Window Sample Length: " + QString::number(len));
}
void PlotHolderWidget::clear() {
dataPlotWidget->resetPlot();
}