MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / setPlot

Method setPlot

pj_plotting/widget/src/CurveEditor.cpp:259–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257}
258
259void CurveEditor::setPlot(PlotWidget* plot) {
260 if (plot_ == plot) {
261 return;
262 }
263 if (curve_list_connection_) {
264 QObject::disconnect(curve_list_connection_);
265 }
266 if (curve_color_connection_) {
267 QObject::disconnect(curve_color_connection_);
268 }
269 if (plot_destroyed_connection_) {
270 QObject::disconnect(plot_destroyed_connection_);
271 }
272 plot_ = plot;
273 clearActivePicker();
274 if (plot_ != nullptr) {
275 curve_list_connection_ = connect(plot_, &PlotWidgetBase::curveListChanged, this, &CurveEditor::refresh);
276 curve_color_connection_ = connect(plot_, &PlotWidget::curveColorChanged, this, &CurveEditor::onCurveColorChanged);
277 plot_destroyed_connection_ = connect(plot_, &QObject::destroyed, this, [this]() {
278 plot_ = nullptr;
279 clearActivePicker();
280 ui_->listWidget->clear();
281 });
282 }
283 refresh();
284}
285
286void CurveEditor::refresh() {
287 // Clear without firing selection-change handlers; we re-evaluate at the end.

Callers 1

bindEditorToPlotMethod · 0.80

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected