Update calibration widget tooltip when span changes

This commit is contained in:
Jan Käberich 2020-12-07 17:58:13 +01:00
parent 87d3cd3e6e
commit 15c7492bec
3 changed files with 19 additions and 9 deletions

View File

@ -748,7 +748,7 @@ bool Calibration::saveToFile(QString filename)
*/ */
QString Calibration::descriptiveCalName(){ QString Calibration::descriptiveCalName(){
int precision = 3; 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); QString hi = Unit::ToString(this->maxFreq, "", " kMG", precision);
// due to rounding up 123.66M and 123.99M -> we get lo="124M" and hi="124M" // due to rounding up 123.66M and 123.99M -> we get lo="124M" and hi="124M"
// so let's add some precision // so let's add some precision

View File

@ -287,10 +287,9 @@ VNA::VNA(AppWindow *window)
// Calibration toolbar (and populate calibration menu) // Calibration toolbar (and populate calibration menu)
auto tb_cal = new QToolBar("Calibration"); auto tb_cal = new QToolBar("Calibration");
QLabel *cbEnableCal_label = new QLabel("Calibration:"); calLabel = new QLabel("Calibration:");
cbEnableCal_label->setStyleSheet(getCalStyle()); // on app start UpdateCalWidget();
cbEnableCal_label->setToolTip(getCalToolTip()); // no cal. file loaded tb_cal->addWidget(calLabel);
tb_cal->addWidget(cbEnableCal_label);
auto cbEnableCal = new QCheckBox; auto cbEnableCal = new QCheckBox;
tb_cal->addWidget(cbEnableCal); tb_cal->addWidget(cbEnableCal);
auto cbType = new QComboBox(); auto cbType = new QComboBox();
@ -329,8 +328,9 @@ VNA::VNA(AppWindow *window)
cbEnableCal->blockSignals(true); cbEnableCal->blockSignals(true);
calDisable->setChecked(true); calDisable->setChecked(true);
cbEnableCal->setCheckState(Qt::CheckState::Unchecked); cbEnableCal->setCheckState(Qt::CheckState::Unchecked);
cbEnableCal_label->setStyleSheet(getCalStyle()); // visually indicate loss of calibration // visually indicate loss of calibration
cbEnableCal_label->setToolTip(getCalToolTip()); // cal. file unknown at this moment // cal. file unknown at this moment
UpdateCalWidget();
cbType->blockSignals(false); cbType->blockSignals(false);
cbEnableCal->blockSignals(false); cbEnableCal->blockSignals(false);
calImportTerms->setEnabled(false); calImportTerms->setEnabled(false);
@ -348,8 +348,9 @@ VNA::VNA(AppWindow *window)
} }
} }
cbEnableCal->setCheckState(Qt::CheckState::Checked); cbEnableCal->setCheckState(Qt::CheckState::Checked);
cbEnableCal_label->setStyleSheet(getCalStyle()); // restore default look of widget // restore default look of widget
cbEnableCal_label->setToolTip(getCalToolTip()); // on hover, show name of active cal. file // on hover, show name of active cal. file
UpdateCalWidget();
cbType->blockSignals(false); cbType->blockSignals(false);
cbEnableCal->blockSignals(false); cbEnableCal->blockSignals(false);
calImportTerms->setEnabled(true); calImportTerms->setEnabled(true);
@ -582,6 +583,7 @@ void VNA::SettingsChanged(std::function<void (Device::TransmissionResult)> cb)
average.reset(settings.points); average.reset(settings.points);
traceModel.clearVNAData(); traceModel.clearVNAData();
UpdateAverageCount(); UpdateAverageCount();
UpdateCalWidget();
emit traceModel.SpanChanged(settings.f_start, settings.f_stop); emit traceModel.SpanChanged(settings.f_start, settings.f_stop);
} }
@ -859,3 +861,9 @@ void VNA::StartCalibrationDialog(Calibration::Type type)
}); });
traceDialog->show(); traceDialog->show();
} }
void VNA::UpdateCalWidget()
{
calLabel->setStyleSheet(getCalStyle());
calLabel->setToolTip(getCalToolTip());
}

View File

@ -56,6 +56,7 @@ private:
void StoreSweepSettings(); void StoreSweepSettings();
void StopSweep(); void StopSweep();
void StartCalibrationDialog(Calibration::Type type = Calibration::Type::None); void StartCalibrationDialog(Calibration::Type type = Calibration::Type::None);
void UpdateCalWidget();
Protocol::SweepSettings settings; Protocol::SweepSettings settings;
unsigned int averages; unsigned int averages;
@ -82,6 +83,7 @@ private:
// Status Labels // Status Labels
QLabel *lAverages; QLabel *lAverages;
QLabel *calLabel;
TileWidget *central; TileWidget *central;