From dc5cb73b3f81a47912d55dce4cd6e5b13be0448a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20K=C3=A4berich?= Date: Thu, 13 Jan 2022 19:34:57 +0100 Subject: [PATCH] Bugfix: time gate filter size, improve dialog shutdown --- .../PC_Application/Traces/Math/timegate.cpp | 18 ++---------------- .../PC_Application/Traces/traceeditdialog.cpp | 5 +++-- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/Software/PC_Application/Traces/Math/timegate.cpp b/Software/PC_Application/Traces/Math/timegate.cpp index 5e89b79..fd28af8 100644 --- a/Software/PC_Application/Traces/Math/timegate.cpp +++ b/Software/PC_Application/Traces/Math/timegate.cpp @@ -237,15 +237,6 @@ void Math::TimeGate::updateFilter() auto maxX = input->rData().back().x; auto minX = input->rData().front().x; -// auto c1 = center - span / 2; -// auto c2 = center + span / 2; - -// if(c1 < minX) { -// c1 = minX; -// } -// if(c2 > maxX) { -// c2 = maxX; -// } auto wc1 = Util::Scale(center - span / 2, minX, maxX, 0, 1); auto wc2 = Util::Scale(center + span / 2, minX, maxX, 0, 1); @@ -270,7 +261,7 @@ void Math::TimeGate::updateFilter() Fft::shift(buf, true); Fft::transform(buf, false); - filter.resize(buf.size()); + filter.resize(buf.size() / 2); for(unsigned int i=0;i(y_last, -120, 20, plotBottom, plotTop)); p2.setX(Util::Scale(now.x, minX, maxX, plotLeft, plotRight)); p2.setY(Util::Scale(y_now, -120, 20, plotBottom, plotTop)); -// auto p1 = plotValueToPixel(last.x, y_last); -// auto p2 = plotValueToPixel(now.x, y_now); // draw line p.drawLine(p1, p2); } @@ -398,7 +387,7 @@ void Math::TimeGateGraph::paintEvent(QPaintEvent *event) auto filter = gate->rFilter(); pen = QPen(Qt::red, 1); p.setPen(pen); - for(unsigned int i=increment;i(f_last, -120, 20, plotBottom, plotTop)); p2.setX(Util::Scale(x_now, minX, maxX, plotLeft, plotRight)); p2.setY(Util::Scale(f_now, -120, 20, plotBottom, plotTop)); -// auto p1 = plotValueToPixel(x_last, f_last); -// auto p2 = plotValueToPixel(x_now, f_now); - // draw line p.drawLine(p1, p2); } diff --git a/Software/PC_Application/Traces/traceeditdialog.cpp b/Software/PC_Application/Traces/traceeditdialog.cpp index 15f15d1..0c96c5c 100644 --- a/Software/PC_Application/Traces/traceeditdialog.cpp +++ b/Software/PC_Application/Traces/traceeditdialog.cpp @@ -169,7 +169,7 @@ TraceEditDialog::TraceEditDialog(Trace &t, QWidget *parent) : auto d = new QDialog(); auto ui = new Ui::NewTraceMathDialog(); ui->setupUi(d); - connect(d, &QDialog::finished, [=](){ + connect(d, &QDialog::rejected, [=](){ delete ui; }); for(int i = 0; i < (int) TraceMath::Type::Last;i++) { @@ -184,8 +184,9 @@ TraceEditDialog::TraceEditDialog(Trace &t, QWidget *parent) : connect(ui->list, &QListWidget::currentRowChanged, ui->stack, &QStackedWidget::setCurrentIndex); connect(ui->list, &QListWidget::doubleClicked, ui->buttonBox, &QDialogButtonBox::accepted); - connect(ui->buttonBox, &QDialogButtonBox::accepted, [=](){ + connect(d, &QDialog::accepted, [=](){ auto type = static_cast(ui->list->currentRow()); + delete ui; auto newMath = TraceMath::createMath(type); model->addOperations(newMath); if(newMath.size() == 1) {