From 4f945367ebc8e34263acbfca0416e3f75653924e Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 30 Mar 2025 19:16:07 +0530 Subject: Update window title on tab change + refactoring --- src/widgets/WebViewStack.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/widgets/WebViewStack.cpp') diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp index f01b75c..6de170a 100644 --- a/src/widgets/WebViewStack.cpp +++ b/src/widgets/WebViewStack.cpp @@ -17,6 +17,9 @@ WebViewStack::WebViewStack(const Configuration *configuration, layout->setContentsMargins(0, 0, 0, 0); layout->setStackingMode(QStackedLayout::StackOne); + connect(layout, &QStackedLayout::currentChanged, this, + &WebViewStack::current_webview_changed); + create_new_webview(configuration->new_tab_url, true); } @@ -50,6 +53,8 @@ WebView *WebViewStack::create_new_webview(const QUrl &url, bool focus) { if (focus) focus_webview(webview->get_id()); + emit current_webview_changed(layout->currentIndex()); + return webview; } @@ -116,6 +121,7 @@ void WebViewStack::close(WebViewId webview_id) { // TODO: Close window on empty if (webview_list.isEmpty()) { + // window()->close(); create_new_webview(configuration->new_tab_url, true); } } -- cgit v1.3.1