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

Method bindEditorToPlot

pj_app/src/MainWindow.cpp:4030–4058  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4028}
4029
4030void MainWindow::bindEditorToPlot(PlotWidget* plot) {
4031 if (curve_editor_ != nullptr) {
4032 curve_editor_->setPlot(plot);
4033 }
4034 // The width/style buttons act on the editor's plot, so keep them
4035 // visibly disabled when there is none to act on.
4036 const bool enable = plot != nullptr;
4037 // Style/width are plot-level, so the toolbar must reflect the plot we just
4038 // bound to (not the last button clicked). The group ids are the LineWidth
4039 // index / CurveStyle enum value. Resync happens on every active-plot change;
4040 // an in-place state swap on the focused plot (xmlLoadState / paste) is not
4041 // covered, since the bound plot does not change there.
4042 if (width_button_group_ != nullptr) {
4043 for (auto* btn : width_button_group_->buttons()) {
4044 btn->setEnabled(enable);
4045 }
4046 if (plot != nullptr) {
4047 checkGroupButton(width_button_group_, static_cast<int>(plot->lineWidth()));
4048 }
4049 }
4050 if (style_button_group_ != nullptr) {
4051 for (auto* btn : style_button_group_->buttons()) {
4052 btn->setEnabled(enable);
4053 }
4054 if (plot != nullptr) {
4055 checkGroupButton(style_button_group_, static_cast<int>(plot->defaultCurveStyle()));
4056 }
4057 }
4058}
4059
4060PlotWidget* MainWindow::firstPlotOfActiveTab() const {
4061 auto* docker = ui_->tabbedPlotWidget->currentTab();

Callers

nothing calls this directly

Calls 5

checkGroupButtonFunction · 0.85
setPlotMethod · 0.80
defaultCurveStyleMethod · 0.80
setEnabledMethod · 0.45
lineWidthMethod · 0.45

Tested by

no test coverage detected