add statistics to GraphicAnalysis

This commit is contained in:
2023-08-02 12:32:09 +03:00
parent d98e8c1f30
commit 1b06de0dc4
9 changed files with 558 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
#include "graphic_analysis.h"
#include "graphic_analysis_stat.h"
#include "qad_types.h"
#include "ui_graphic_analysis.h"
@@ -56,9 +57,11 @@ GraphicAnalysis::GraphicAnalysis(QWidget * parent): GraphicRanges(parent) {
ui = new Ui::GraphicAnalysis();
ui->setupUi(widget_toolbox);
ui->widgetSpectrum->hide();
window_stat = new GraphicAnalysisStatistics();
connect(ui->checkSpectrum, SIGNAL(toggled(bool)), this, SLOT(checkSpectrum_toggled(bool)));
connect(ui->buttonSpectrumRange, SIGNAL(toggled(bool)), this, SLOT(buttonSpectrumRange_toggled(bool)));
connect(ui->checkSpectrumFixDuration, SIGNAL(toggled(bool)), this, SLOT(checkSpectrumFixDuration_toggled(bool)));
connect(ui->buttonStatistics, SIGNAL(toggled(bool)), this, SLOT(buttonStatistics_toggled(bool)));
auto * lay = qobject_cast<QBoxLayout *>(layout());
lay->insertWidget(0, widget_toolbox);
connect(ui->spinSpectrumDuration, SIGNAL(valueChanged(double)), this, SIGNAL(configChanged()));
@@ -70,8 +73,8 @@ GraphicAnalysis::GraphicAnalysis(QWidget * parent): GraphicRanges(parent) {
GraphicAnalysis::~GraphicAnalysis() {
delete window_stat;
delete ui;
delete widget_toolbox;
}
@@ -119,13 +122,13 @@ void GraphicAnalysis::setLabelX(const QString & str) {
}
QBoxLayout * GraphicAnalysis::toolboxLayout() {
return reinterpret_cast<QBoxLayout *>(widget_toolbox->layout());
QWidget * GraphicAnalysis::toolboxWidget() {
return widget_toolbox;
}
QWidget * GraphicAnalysis::toolboxWidget() {
return widget_toolbox;
void GraphicAnalysis::setShowSpectrum(bool on) {
ui->checkSpectrum->setChecked(on);
}
@@ -293,10 +296,15 @@ void GraphicAnalysis::gaMouseReleaseEvent(QPointF point, int buttons) {
void GraphicAnalysis::gaRangeSelected(double start, double end) {
if (!ui->buttonSpectrumRange->isChecked()) return;
ui->buttonSpectrumRange->setChecked(false);
range_fft = GraphicRanges::Range(start, end);
updateAllGraphic();
if (ui->buttonSpectrumRange->isChecked()) {
ui->buttonSpectrumRange->setChecked(false);
range_fft = GraphicRanges::Range(start, end);
updateAllGraphic();
}
if (ui->buttonStatistics->isChecked()) {
ui->buttonStatistics->setChecked(false);
window_stat->show(this, GraphicRanges::Range(start, end));
}
}
@@ -308,9 +316,10 @@ void GraphicAnalysis::checkSpectrum_toggled(bool on) {
void GraphicAnalysis::buttonSpectrumRange_toggled(bool on) {
setFFT(!on);
if (on)
if (on) {
ui->buttonStatistics->setChecked(false);
checkRangeRequest();
else
} else
viewport()->unsetCursor();
}
@@ -319,3 +328,12 @@ void GraphicAnalysis::checkSpectrumFixDuration_toggled(bool on) {
checkRangeRequest();
emit configChanged();
}
void GraphicAnalysis::buttonStatistics_toggled(bool on) {
if (on) {
ui->buttonSpectrumRange->setChecked(false);
rangeRequest();
} else
viewport()->unsetCursor();
}