Calibration - show in tooltip

This commit is contained in:
Zoran Kostic 2020-11-30 18:16:33 +01:00
parent cde385935d
commit 3fae95b33f
3 changed files with 14 additions and 1 deletions

View File

@ -709,6 +709,7 @@ bool Calibration::openFromFile(QString filename)
qWarning() << "Calibration file parsing failed: " << e.what(); qWarning() << "Calibration file parsing failed: " << e.what();
return false; return false;
} }
this->currentCalFile = filename; // if all ok, remember this and show on widget
return true; return true;
} }
@ -741,6 +742,7 @@ bool Calibration::saveToFile(QString filename)
auto calkit_file = filename + ".calkit"; auto calkit_file = filename + ".calkit";
qDebug() << "Saving associated calibration kit to file" << calkit_file; qDebug() << "Saving associated calibration kit to file" << calkit_file;
kit.toFile(calkit_file); kit.toFile(calkit_file);
this->currentCalFile = calibration_file; // if all ok, remember this and show on widget
return true; return true;
} }
@ -770,6 +772,10 @@ QString Calibration::hzToString(double freqHz){
return res; return res;
} }
QString Calibration::getCurrentCalibrationFile(){
return this->currentCalFile;
}
ostream& operator<<(ostream &os, const Calibration &c) ostream& operator<<(ostream &os, const Calibration &c)
{ {
for(auto m : c.measurements) { for(auto m : c.measurements) {

View File

@ -138,6 +138,11 @@ private:
Calkit kit; Calkit kit;
QString hzToString(double freqHz); QString hzToString(double freqHz);
private:
QString currentCalFile;
public:
QString getCurrentCalibrationFile();
}; };
#endif // CALIBRATION_H #endif // CALIBRATION_H

View File

@ -287,7 +287,7 @@ 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");
auto cbEnableCal_label = new QLabel("Calibration:"); QLabel *cbEnableCal_label = new QLabel("Calibration:");
tb_cal->addWidget(cbEnableCal_label); tb_cal->addWidget(cbEnableCal_label);
auto cbEnableCal = new QCheckBox; auto cbEnableCal = new QCheckBox;
tb_cal->addWidget(cbEnableCal); tb_cal->addWidget(cbEnableCal);
@ -328,6 +328,7 @@ VNA::VNA(AppWindow *window)
calDisable->setChecked(true); calDisable->setChecked(true);
cbEnableCal->setCheckState(Qt::CheckState::Unchecked); cbEnableCal->setCheckState(Qt::CheckState::Unchecked);
cbEnableCal_label->setStyleSheet("background-color: yellow"); cbEnableCal_label->setStyleSheet("background-color: yellow");
cbEnableCal_label->setToolTip("none");
cbType->blockSignals(false); cbType->blockSignals(false);
cbEnableCal->blockSignals(false); cbEnableCal->blockSignals(false);
calImportTerms->setEnabled(false); calImportTerms->setEnabled(false);
@ -346,6 +347,7 @@ VNA::VNA(AppWindow *window)
} }
cbEnableCal->setCheckState(Qt::CheckState::Checked); cbEnableCal->setCheckState(Qt::CheckState::Checked);
cbEnableCal_label->setStyleSheet(""); cbEnableCal_label->setStyleSheet("");
cbEnableCal_label->setToolTip(cal.getCurrentCalibrationFile());
cbType->blockSignals(false); cbType->blockSignals(false);
cbEnableCal->blockSignals(false); cbEnableCal->blockSignals(false);
calImportTerms->setEnabled(true); calImportTerms->setEnabled(true);