Fix calibration progress dialog
This commit is contained in:
parent
8a6bff5248
commit
69fe833715
@ -66,10 +66,8 @@ VNA::VNA(AppWindow *window, QString name)
|
|||||||
singleSweep = false;
|
singleSweep = false;
|
||||||
calMeasuring = false;
|
calMeasuring = false;
|
||||||
calWaitFirst = false;
|
calWaitFirst = false;
|
||||||
calDialog.reset();
|
calDialog = nullptr;
|
||||||
// A modal QProgressDialog calls processEvents() in setValue(). Needs to use a queued connection to update the progress
|
|
||||||
// value from within the NewDatapoint slot to prevent possible re-entrancy.
|
|
||||||
connect(this, &VNA::calibrationMeasurementPercentage, &calDialog, &QProgressDialog::setValue, Qt::QueuedConnection);
|
|
||||||
changingSettings = false;
|
changingSettings = false;
|
||||||
settings.sweepType = SweepType::Frequency;
|
settings.sweepType = SweepType::Frequency;
|
||||||
settings.zerospan = false;
|
settings.zerospan = false;
|
||||||
@ -891,7 +889,7 @@ void VNA::NewDatapoint(DeviceDriver::VNAMeasurement m)
|
|||||||
if(m_avg.pointNum == settings.npoints - 1) {
|
if(m_avg.pointNum == settings.npoints - 1) {
|
||||||
calMeasuring = false;
|
calMeasuring = false;
|
||||||
cal.measurementsComplete();
|
cal.measurementsComplete();
|
||||||
calDialog.reset();
|
delete calDialog;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1249,18 +1247,24 @@ void VNA::StartCalibrationMeasurements(std::set<CalibrationMeasurement::Base*> m
|
|||||||
} else {
|
} else {
|
||||||
text.append("multiple calibration standards.");
|
text.append("multiple calibration standards.");
|
||||||
}
|
}
|
||||||
calDialog.setLabelText(text);
|
calDialog = new QProgressDialog();
|
||||||
calDialog.setCancelButtonText("Abort");
|
calDialog->setLabelText(text);
|
||||||
calDialog.setWindowTitle("Taking calibration measurement...");
|
calDialog->setCancelButtonText("Abort");
|
||||||
calDialog.setValue(0);
|
calDialog->setWindowTitle("Taking calibration measurement...");
|
||||||
calDialog.setWindowModality(Qt::ApplicationModal);
|
calDialog->setValue(0);
|
||||||
|
calDialog->setWindowModality(Qt::ApplicationModal);
|
||||||
// always show the dialog
|
// always show the dialog
|
||||||
calDialog.setMinimumDuration(0);
|
calDialog->setMinimumDuration(0);
|
||||||
connect(&calDialog, &QProgressDialog::canceled, [=]() {
|
// A modal QProgressDialog calls processEvents() in setValue(). Needs to use a queued connection to update the progress
|
||||||
|
// value from within the NewDatapoint slot to prevent possible re-entrancy.
|
||||||
|
connect(this, &VNA::calibrationMeasurementPercentage, calDialog, &QProgressDialog::setValue, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(calDialog, &QProgressDialog::canceled, this, [=]() {
|
||||||
// the user aborted the calibration measurement
|
// the user aborted the calibration measurement
|
||||||
calMeasuring = false;
|
calMeasuring = false;
|
||||||
cal.clearMeasurements(calMeasurements);
|
cal.clearMeasurements(calMeasurements);
|
||||||
});
|
delete calDialog;
|
||||||
|
}, Qt::UniqueConnection);
|
||||||
// Trigger sweep to start from beginning
|
// Trigger sweep to start from beginning
|
||||||
running = true;
|
running = true;
|
||||||
ConfigureDevice(true, [=](bool){
|
ConfigureDevice(true, [=](bool){
|
||||||
|
@ -150,7 +150,7 @@ private:
|
|||||||
std::set<CalibrationMeasurement::Base*> calMeasurements;
|
std::set<CalibrationMeasurement::Base*> calMeasurements;
|
||||||
bool calMeasuring;
|
bool calMeasuring;
|
||||||
bool calWaitFirst;
|
bool calWaitFirst;
|
||||||
QProgressDialog calDialog;
|
QProgressDialog *calDialog;
|
||||||
Calibration::InterpolationType getCalInterpolation();
|
Calibration::InterpolationType getCalInterpolation();
|
||||||
QString getCalStyle();
|
QString getCalStyle();
|
||||||
QString getCalToolTip();
|
QString getCalToolTip();
|
||||||
|
Loading…
Reference in New Issue
Block a user