Merge pull request #36 from sophiekovalevsky/update-plots
gui: replot active mode when settings plot are updated
This commit is contained in:
commit
d7ae23bdda
@ -69,6 +69,12 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window)
|
||||
traceXY->setYAxis(0, TraceXYPlot::YAxisType::Magnitude, false, false, -120,0,10);
|
||||
traceXY->setYAxis(1, TraceXYPlot::YAxisType::Disabled, false, true, 0,0,1);
|
||||
|
||||
connect(this, &SpectrumAnalyzer::graphColorsChanged, [=](){
|
||||
for (auto p : TracePlot::getPlots()) {
|
||||
p->updateGraphColors();
|
||||
}
|
||||
});
|
||||
|
||||
central->setPlot(traceXY);
|
||||
|
||||
// Create menu entries and connections
|
||||
@ -960,3 +966,8 @@ void SpectrumAnalyzer::StoreSweepSettings()
|
||||
s.setValue("SAAveraging", averages);
|
||||
s.setValue("SASignalID", static_cast<bool>(settings.SignalID));
|
||||
}
|
||||
|
||||
void SpectrumAnalyzer::updateGraphColors()
|
||||
{
|
||||
emit graphColorsChanged();
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ public:
|
||||
virtual nlohmann::json toJSON() override;
|
||||
virtual void fromJSON(nlohmann::json j) override;
|
||||
|
||||
void updateGraphColors();
|
||||
|
||||
|
||||
private:
|
||||
enum class Window {
|
||||
None = 0,
|
||||
@ -117,6 +120,7 @@ signals:
|
||||
void NormalizationLevelChanged(double level);
|
||||
|
||||
void averagingChanged(unsigned int averages);
|
||||
void graphColorsChanged();
|
||||
};
|
||||
|
||||
#endif // VNA_H
|
||||
|
@ -391,3 +391,8 @@ void TracePlot::markerRemoved(Marker *m)
|
||||
disconnect(m, &Marker::symbolChanged, this, &TracePlot::triggerReplot);
|
||||
triggerReplot();
|
||||
}
|
||||
|
||||
void TracePlot::updateGraphColors()
|
||||
{
|
||||
replot();
|
||||
}
|
||||
|
@ -28,6 +28,9 @@ public:
|
||||
|
||||
static std::set<TracePlot *> getPlots();
|
||||
|
||||
public slots:
|
||||
void updateGraphColors();
|
||||
|
||||
signals:
|
||||
void doubleClicked(QWidget *w);
|
||||
void deleted(TracePlot*);
|
||||
|
@ -18,6 +18,7 @@ public:
|
||||
virtual void fromJSON(nlohmann::json j) override;
|
||||
public slots:
|
||||
void axisSetupDialog();
|
||||
|
||||
protected:
|
||||
static constexpr double ReferenceImpedance = 50.0;
|
||||
static constexpr double screenUsage = 0.9;
|
||||
|
@ -75,6 +75,7 @@ VNA::VNA(AppWindow *window)
|
||||
|
||||
auto tracesmith1 = new TraceSmithChart(traceModel);
|
||||
tracesmith1->enableTrace(tS11, true);
|
||||
|
||||
auto tracesmith2 = new TraceSmithChart(traceModel);
|
||||
tracesmith2->enableTrace(tS22, true);
|
||||
|
||||
@ -83,6 +84,12 @@ VNA::VNA(AppWindow *window)
|
||||
auto traceXY2 = new TraceXYPlot(traceModel);
|
||||
traceXY2->enableTrace(tS21, true);
|
||||
|
||||
connect(this, &VNA::graphColorsChanged, [=](){
|
||||
for (auto p : TracePlot::getPlots()) {
|
||||
p->updateGraphColors();
|
||||
}
|
||||
});
|
||||
|
||||
connect(&traceModel, &TraceModel::requiredExcitation, this, &VNA::ExcitationRequired);
|
||||
|
||||
central->splitVertically();
|
||||
@ -1117,3 +1124,8 @@ void VNA::EnableDeembedding(bool enable)
|
||||
enableDeembeddingAction->setChecked(enable);
|
||||
enableDeembeddingAction->blockSignals(false);
|
||||
}
|
||||
|
||||
void VNA::updateGraphColors()
|
||||
{
|
||||
emit graphColorsChanged();
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ public:
|
||||
// Only save/load user changeable stuff, no need to save the widgets/mode name etc.
|
||||
virtual nlohmann::json toJSON() override;
|
||||
virtual void fromJSON(nlohmann::json j) override;
|
||||
|
||||
void updateGraphColors();
|
||||
|
||||
private slots:
|
||||
void NewDatapoint(Protocol::Datapoint d);
|
||||
void StartImpedanceMatching();
|
||||
@ -48,8 +51,10 @@ private slots:
|
||||
void ApplyCalibration(Calibration::Type type);
|
||||
void StartCalibrationMeasurement(Calibration::Measurement m);
|
||||
|
||||
|
||||
signals:
|
||||
void CalibrationMeasurementComplete(Calibration::Measurement m);
|
||||
void graphColorsChanged();
|
||||
|
||||
private:
|
||||
bool CalibrationMeasurementActive() { return calWaitFirst || calMeasuring; }
|
||||
|
@ -202,8 +202,15 @@ AppWindow::AppWindow(QWidget *parent)
|
||||
StartTCPServer(p.General.SCPI.port);
|
||||
}
|
||||
}
|
||||
// settings might have changed, update necessary stuff
|
||||
// TraceXYPlot::updateGraphColors();
|
||||
auto active = Mode::getActiveMode();
|
||||
|
||||
if(active == spectrumAnalyzer) {
|
||||
spectrumAnalyzer->updateGraphColors();
|
||||
}
|
||||
else if (active == vna) {
|
||||
vna->updateGraphColors();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
connect(ui->actionAbout, &QAction::triggered, [=](){
|
||||
|
Loading…
Reference in New Issue
Block a user