From eecee7369fb4566cdb057ffb764a5fd63f00a0fb Mon Sep 17 00:00:00 2001 From: Aaron Dewes Date: Thu, 22 Sep 2022 18:23:59 +0200 Subject: [PATCH] Ladybird: Clean up tab bar autohide Qt has this feature built-in, so there's no need to create a custom implementation --- Ladybird/BrowserWindow.cpp | 10 +--------- Ladybird/BrowserWindow.h | 2 -- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Ladybird/BrowserWindow.cpp b/Ladybird/BrowserWindow.cpp index 6269a7fe89..83fea005d0 100644 --- a/Ladybird/BrowserWindow.cpp +++ b/Ladybird/BrowserWindow.cpp @@ -26,9 +26,7 @@ BrowserWindow::BrowserWindow() m_tabs_container->setMovable(true); m_tabs_container->setTabsClosable(true); m_tabs_container->setDocumentMode(true); - - m_tabs_bar = m_tabs_container->findChild(); - m_tabs_bar->hide(); + m_tabs_container->setTabBarAutoHide(true); auto* menu = menuBar()->addMenu("&File"); @@ -251,9 +249,6 @@ void BrowserWindow::new_tab() QObject::connect(tab_ptr, &Tab::title_changed, this, &BrowserWindow::tab_title_changed); QObject::connect(tab_ptr, &Tab::favicon_changed, this, &BrowserWindow::tab_favicon_changed); - if (m_tabs_container->count() > 1) - m_tabs_bar->show(); - tab_ptr->focus_location_editor(); } @@ -264,9 +259,6 @@ void BrowserWindow::close_tab(int index) m_tabs.remove_first_matching([&](auto& entry) { return entry == tab; }); - - if (m_tabs_container->count() <= 1) - m_tabs_bar->hide(); } void BrowserWindow::close_current_tab() diff --git a/Ladybird/BrowserWindow.h b/Ladybird/BrowserWindow.h index ef15e84c6e..ac96cd1ca0 100644 --- a/Ladybird/BrowserWindow.h +++ b/Ladybird/BrowserWindow.h @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -44,7 +43,6 @@ private: void debug_request(String const& request, String const& argument = ""); QTabWidget* m_tabs_container { nullptr }; - QTabBar* m_tabs_bar { nullptr }; NonnullOwnPtrVector m_tabs; Tab* m_current_tab { nullptr }; };