fix for future qt versions: keep one instance of the calibation progressbar

This commit is contained in:
Jan Käberich 2024-12-01 18:17:39 +01:00
parent e2bbd6fad3
commit 57e6812cf8
3 changed files with 21 additions and 40 deletions

View file

@ -76,6 +76,7 @@ Application
/LibreVNA-GUI/LibreVNA-GUI
/LibreVNA-Test/LibreVNA-Test
/LibreVNA-GUI/users*appdatalocaltemp*
/LibreVNA/build

View file

@ -1,21 +0,0 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 1
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++ \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/x86_64-w64-mingw32 \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include/c++/backward \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0/include-fixed \
C:/Qt/Tools/mingw810_64/x86_64-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/Qt/Tools/mingw810_64/lib/gcc/x86_64-w64-mingw32/8.1.0 \
C:/Qt/Tools/mingw810_64/lib/gcc \
C:/Qt/Tools/mingw810_64/x86_64-w64-mingw32/lib \
C:/Qt/Tools/mingw810_64/lib

View file

@ -158,6 +158,26 @@ VNA::VNA(AppWindow *window, QString name)
cal.getKit().setIdealDefault();
calDialog = new QProgressDialog();
calDialog->setCancelButtonText("Abort");
calDialog->setWindowTitle("Taking calibration measurement...");
calDialog->setValue(0);
calDialog->setWindowModality(Qt::ApplicationModal);
calDialog->reset();
calDialog->setMinimumDuration(0);
// 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
calMeasuring = false;
cal.clearMeasurements(calMeasurements);
cal.measurementsAbort();
// delete calDialog;
});
// portExtension.setCalkit(&cal.getCalibrationKit());
// De-embedding menu
@ -960,8 +980,6 @@ void VNA::NewDatapoint(DeviceDriver::VNAMeasurement m)
cal.addMeasurements(calMeasurements, m_avg);
if(m_avg.pointNum == settings.npoints - 1) {
calMeasuring = false;
calDialog->deleteLater();
calDialog = nullptr;
cal.measurementsComplete();
}
}
@ -1346,25 +1364,8 @@ void VNA::StartCalibrationMeasurements(std::set<CalibrationMeasurement::Base*> m
} else {
text.append("multiple calibration standards.");
}
calDialog = new QProgressDialog();
calDialog->setLabelText(text);
calDialog->setCancelButtonText("Abort");
calDialog->setWindowTitle("Taking calibration measurement...");
calDialog->setValue(0);
calDialog->setWindowModality(Qt::ApplicationModal);
// always show the dialog
calDialog->setMinimumDuration(0);
// 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
calMeasuring = false;
cal.clearMeasurements(calMeasurements);
cal.measurementsAbort();
delete calDialog;
}, Qt::UniqueConnection);
// Trigger sweep to start from beginning
running = true;
ConfigureDevice(true, [=](bool){