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

Method updateAlias

pj_plotting/widget/src/FilterEditorPanel.cpp:293–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

291}
292
293void FilterEditorPanel::updateAlias() {
294 // The alias is editable; once the user has typed, never overwrite it.
295 if (alias_user_edited_) {
296 return;
297 }
298 const std::string id = currentFilterId();
299 if (id == "none") {
300 ui_->alias_edit->clear();
301 return;
302 }
303
304 // Primary source = the first selected curve, else the first available curve.
305 // Resolve a filter-output source to its original input so the alias reads
306 // "<input>[Transform]", never "<input>[Old][New]".
307 QString primary;
308 const QList<QListWidgetItem*> selected = ui_->series_list->selectedItems();
309 if (!selected.isEmpty()) {
310 const int idx = selected.front()->data(Qt::UserRole).toInt();
311 primary = readableName(originalInputOf(sources_[static_cast<std::size_t>(idx)]));
312 } else if (!sources_.empty()) {
313 primary = readableName(originalInputOf(sources_[0]));
314 }
315
316 const QListWidgetItem* transform_item = ui_->transform_list->currentItem();
317 const QString label = transform_item ? transform_item->text() : QString();
318 ui_->alias_edit->setText(primary + "[" + label + "]");
319}
320
321void FilterEditorPanel::setPreviewDisplay(bool grid_visible, PlotWidgetBase::CurveStyle style, LineWidth width) {
322 preview_grid_ = grid_visible;

Callers

nothing calls this directly

Calls 9

readableNameFunction · 0.85
toIntMethod · 0.80
QStringClass · 0.50
clearMethod · 0.45
isEmptyMethod · 0.45
dataMethod · 0.45
emptyMethod · 0.45
textMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected