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

Method addTab

pj_plotting/widget/src/TabbedPlotWidget.cpp:342–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

340}
341
342PlotDocker* TabbedPlotWidget::addTab(QString tab_name) {
343 if (tab_name.isEmpty()) {
344 tab_name = QString("tab%1").arg(++tab_suffix_count_);
345 }
346 PlotDocker* docker = createDocker(tab_name);
347 PlotTabFrame* frame = createTabFrame(tab_name, docker);
348
349 stack_->addWidget(docker);
350 // Insert frame just before the add-button (which is at index 0 after
351 // the stretch we appended) so tabs grow leftward of the [+] button.
352 // Explicit AlignVCenter — same rationale as the [+] button: matches
353 // the 1-px-breathing-room rhythm of the rest of the chrome bars.
354 const int insert_index = static_cast<int>(tabs_.size());
355 tabs_bar_layout_->insertWidget(insert_index, frame, 0, Qt::AlignVCenter);
356 tabs_.push_back({frame, docker});
357
358 emit tabAdded(docker);
359
360 stack_->setCurrentWidget(docker);
361 updateSelectionStyle();
362 emit currentTabChanged(docker);
363 return docker;
364}
365
366void TabbedPlotWidget::setDataServices(SessionManager* session, CatalogModel* catalog) {
367 session_ = session;

Callers 1

TESTFunction · 0.80

Calls 3

QStringClass · 0.50
isEmptyMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.64