| 340 | } |
| 341 | |
| 342 | PlotDocker* 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 | |
| 366 | void TabbedPlotWidget::setDataServices(SessionManager* session, CatalogModel* catalog) { |
| 367 | session_ = session; |