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(){
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

View File

@ -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<void (Device::TransmissionResult)> 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());
}

View File

@ -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;