Ladybird: Retreive the tab title from the underlying Tab

Rather than getting the tab name from the tab container. This resolves
an issue where ampersands were being introduced to the window title
when changing tabs.
This commit is contained in:
Jamie Mansfield 2024-04-27 14:33:09 +01:00 committed by Tim Flynn
parent b92839fad9
commit c2829ce2a0
Notes: sideshowbarker 2024-07-17 01:51:00 +09:00
2 changed files with 6 additions and 2 deletions

View File

@ -402,8 +402,11 @@ BrowserWindow::BrowserWindow(Vector<URL::URL> const& initial_urls, WebView::Cook
});
QObject::connect(quit_action, &QAction::triggered, this, &QMainWindow::close);
QObject::connect(m_tabs_container, &QTabWidget::currentChanged, [this](int index) {
setWindowTitle(QString("%1 - Ladybird").arg(m_tabs_container->tabText(index)));
set_current_tab(verify_cast<Tab>(m_tabs_container->widget(index)));
auto* tab = verify_cast<Tab>(m_tabs_container->widget(index));
if (tab)
setWindowTitle(QString("%1 - Ladybird").arg(tab->title()));
set_current_tab(tab);
});
QObject::connect(m_tabs_container, &QTabWidget::tabCloseRequested, this, &BrowserWindow::close_tab);
QObject::connect(close_current_tab_action, &QAction::triggered, this, &BrowserWindow::close_current_tab);

View File

@ -52,6 +52,7 @@ public:
void show_inspector_window(InspectorTarget = InspectorTarget::Document);
QIcon const& favicon() const { return m_favicon; }
QString const& title() const { return m_title; }
void update_navigation_buttons_state();