From 6133707df88d0b6e2e9eb62797658c1a88380a07 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Mon, 12 Aug 2024 13:37:11 +0100 Subject: [PATCH] Ladybird/Qt: Display ampersands in tab titles Qt reads ampersands as shortcut keys, so this escapes them (with &&) so they display correctly :^) --- Ladybird/Qt/BrowserWindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Ladybird/Qt/BrowserWindow.cpp b/Ladybird/Qt/BrowserWindow.cpp index c14fb469033..b031e7e0942 100644 --- a/Ladybird/Qt/BrowserWindow.cpp +++ b/Ladybird/Qt/BrowserWindow.cpp @@ -888,7 +888,11 @@ void BrowserWindow::device_pixel_ratio_changed(qreal dpi) void BrowserWindow::tab_title_changed(int index, QString const& title) { - m_tabs_container->setTabText(index, title); + // NOTE: Qt uses ampersands for shortcut keys in tab titles, so we need to escape them. + QString title_escaped = title; + title_escaped.replace("&", "&&"); + + m_tabs_container->setTabText(index, title_escaped); m_tabs_container->setTabToolTip(index, title); if (m_tabs_container->currentIndex() == index)