diff --git a/Software/PC_Application/Calibration/calibration.cpp b/Software/PC_Application/Calibration/calibration.cpp index 4263a52..2a9def0 100644 --- a/Software/PC_Application/Calibration/calibration.cpp +++ b/Software/PC_Application/Calibration/calibration.cpp @@ -748,7 +748,7 @@ bool Calibration::saveToFile(QString filename) */ QString Calibration::descriptiveCalName(){ int precision = 3; - QString lo = Unit::ToString(this->minFreq, "", " kMG", precision); // seems to work, but what are 2nd and 3rd parameters??? + QString lo = Unit::ToString(this->minFreq, "", " kMG", precision); QString hi = Unit::ToString(this->maxFreq, "", " kMG", precision); // due to rounding up 123.66M and 123.99M -> we get lo="124M" and hi="124M" // so let's add some precision diff --git a/Software/PC_Application/VNA/vna.cpp b/Software/PC_Application/VNA/vna.cpp index 258e371..393c708 100644 --- a/Software/PC_Application/VNA/vna.cpp +++ b/Software/PC_Application/VNA/vna.cpp @@ -287,10 +287,9 @@ VNA::VNA(AppWindow *window) // Calibration toolbar (and populate calibration menu) auto tb_cal = new QToolBar("Calibration"); - QLabel *cbEnableCal_label = new QLabel("Calibration:"); - cbEnableCal_label->setStyleSheet(getCalStyle()); // on app start - cbEnableCal_label->setToolTip(getCalToolTip()); // no cal. file loaded - tb_cal->addWidget(cbEnableCal_label); + calLabel = new QLabel("Calibration:"); + UpdateCalWidget(); + tb_cal->addWidget(calLabel); auto cbEnableCal = new QCheckBox; tb_cal->addWidget(cbEnableCal); auto cbType = new QComboBox(); @@ -329,8 +328,9 @@ VNA::VNA(AppWindow *window) cbEnableCal->blockSignals(true); calDisable->setChecked(true); cbEnableCal->setCheckState(Qt::CheckState::Unchecked); - cbEnableCal_label->setStyleSheet(getCalStyle()); // visually indicate loss of calibration - cbEnableCal_label->setToolTip(getCalToolTip()); // cal. file unknown at this moment + // visually indicate loss of calibration + // cal. file unknown at this moment + UpdateCalWidget(); cbType->blockSignals(false); cbEnableCal->blockSignals(false); calImportTerms->setEnabled(false); @@ -348,8 +348,9 @@ VNA::VNA(AppWindow *window) } } cbEnableCal->setCheckState(Qt::CheckState::Checked); - cbEnableCal_label->setStyleSheet(getCalStyle()); // restore default look of widget - cbEnableCal_label->setToolTip(getCalToolTip()); // on hover, show name of active cal. file + // restore default look of widget + // on hover, show name of active cal. file + UpdateCalWidget(); cbType->blockSignals(false); cbEnableCal->blockSignals(false); calImportTerms->setEnabled(true); @@ -582,6 +583,7 @@ void VNA::SettingsChanged(std::function cb) average.reset(settings.points); traceModel.clearVNAData(); UpdateAverageCount(); + UpdateCalWidget(); emit traceModel.SpanChanged(settings.f_start, settings.f_stop); } @@ -859,3 +861,9 @@ void VNA::StartCalibrationDialog(Calibration::Type type) }); traceDialog->show(); } + +void VNA::UpdateCalWidget() +{ + calLabel->setStyleSheet(getCalStyle()); + calLabel->setToolTip(getCalToolTip()); +} diff --git a/Software/PC_Application/VNA/vna.h b/Software/PC_Application/VNA/vna.h index c30de43..e0968dc 100644 --- a/Software/PC_Application/VNA/vna.h +++ b/Software/PC_Application/VNA/vna.h @@ -56,6 +56,7 @@ private: void StoreSweepSettings(); void StopSweep(); void StartCalibrationDialog(Calibration::Type type = Calibration::Type::None); + void UpdateCalWidget(); Protocol::SweepSettings settings; unsigned int averages; @@ -82,6 +83,7 @@ private: // Status Labels QLabel *lAverages; + QLabel *calLabel; TileWidget *central;