X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=31e9f2f9764e8b4603b0264401e065153b597278;hp=775f9dec90a53d628271f5580a829b60b2027035;hb=4a4e20f5e5e3601b99c763dafe1cbfb8c7d6a387;hpb=cbf7b5db5c3c04b95daf77bc0e6dc112c15e0195 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 775f9dec..31e9f2f9 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -307,6 +307,11 @@ void MainWindow::setup_ui() action_about_->setObjectName(QString::fromUtf8("actionAbout")); action_about_->setText(tr("&About...")); + session_selector_.setTabsClosable(true); + + connect(&session_selector_, SIGNAL(tabCloseRequested(int)), + this, SLOT(on_tab_close_requested(int))); + setDockNestingEnabled(true); connect(static_cast(QCoreApplication::instance()), @@ -486,6 +491,18 @@ void MainWindow::on_view_close_clicked() } } +void MainWindow::on_tab_close_requested(int index) +{ + // TODO Ask user if this is intended in case data is unsaved + + // Find the session that belongs to this main window and remove it + for (auto entry : session_windows_) + if (entry.second == session_selector_.widget(index)) { + remove_session(entry.first); + break; + } +} + void MainWindow::on_actionViewStickyScrolling_triggered() { shared_ptr viewbase = get_active_view();