X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fmainwindow.cpp;h=36f9b1a086f9861358f3de8028a4e37ff6e654d5;hp=39ce7ed6f4b0034ad3b0adfc7241cdcd76340779;hb=cc9646457d64b0a74e59ef511c3ae3db345bdbe4;hpb=e7aff437662e4a7dc891952bcb632d67c457d689 diff --git a/pv/mainwindow.cpp b/pv/mainwindow.cpp index 39ce7ed6..36f9b1a0 100644 --- a/pv/mainwindow.cpp +++ b/pv/mainwindow.cpp @@ -248,6 +248,8 @@ shared_ptr MainWindow::add_session() void MainWindow::remove_session(shared_ptr session) { + int h = new_session_button_->height(); + for (shared_ptr view : session->views()) { // Find the dock the view is contained in and remove it for (auto entry : view_docks_) @@ -274,10 +276,21 @@ void MainWindow::remove_session(shared_ptr session) sessions_.remove_if([&](shared_ptr s) { return s == session; }); - // Update the window title if there is no view left to - // generate focus change events - if (sessions_.empty()) + if (sessions_.empty()) { + // When there are no more tabs, the height of the QTabWidget + // drops to zero. We must prevent this to keep the static + // widgets visible + for (QWidget *w : static_tab_widget_->findChildren()) + w->setMinimumHeight(h); + + int margin = static_tab_widget_->layout()->contentsMargins().bottom(); + static_tab_widget_->setMinimumHeight(h + 2 * margin); + session_selector_.setMinimumHeight(h + 2 * margin); + + // Update the window title if there is no view left to + // generate focus change events setWindowTitle(WindowTitle); + } } void MainWindow::setup_ui() @@ -318,11 +331,10 @@ void MainWindow::setup_ui() layout->setContentsMargins(2, 2, 2, 2); layout->addWidget(new_session_button_); - QWidget* static_tab_widget_ = new QWidget(); + static_tab_widget_ = new QWidget(); static_tab_widget_->setLayout(layout); session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner); - session_selector_.setTabsClosable(true); connect(new_session_button_, SIGNAL(clicked(bool)),