From 65b7597659fdd3ef1e1f09661ceb7a18109732af Mon Sep 17 00:00:00 2001 From: Felix Kern Date: Fri, 14 Oct 2016 13:48:23 +0100 Subject: [PATCH] Resist attempts to close GraphDlg while running --- src/gui/GraphDlg.cpp | 10 ++++++++-- src/include/GraphDlg.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/GraphDlg.cpp b/src/gui/GraphDlg.cpp index 9e1b8a1..8d1bad4 100644 --- a/src/gui/GraphDlg.cpp +++ b/src/gui/GraphDlg.cpp @@ -104,6 +104,12 @@ GraphDlg::~GraphDlg() delete ui; } +void GraphDlg::reject() +{ + if ( !dataTimer.isActive() ) + QDialog::reject(); +} + void GraphDlg::reloadGraphs() { ui->plot->clearGraphs(); @@ -161,7 +167,7 @@ void GraphDlg::replot() bool rangeFound; QCPRange range = ui->plot->graph()->getKeyRange(rangeFound); - DataPoint point; + DataPoint point {0., 0.}; if ( initial && q[0]->pop(point) ) { initial = false; @@ -170,7 +176,7 @@ void GraphDlg::replot() int i = 0; double fac; - double tNow; + double tNow = 0.; for ( auto &queue : q ) { if ( Graphp[i].isVoltage ) fac = 1e3; diff --git a/src/include/GraphDlg.h b/src/include/GraphDlg.h index 3c35c29..d16d12f 100644 --- a/src/include/GraphDlg.h +++ b/src/include/GraphDlg.h @@ -41,6 +41,7 @@ public slots: void startPlotting(DCThread *); void stopPlotting(); void reloadGraphs(); + void reject(); }; #endif