Ladybird/Qt: Display ampersands in tab titles

Qt reads ampersands as shortcut keys, so this escapes them (with &&) so
they display correctly :^)
This commit is contained in:
Jamie Mansfield 2024-08-12 13:37:11 +01:00 committed by Jelle Raaijmakers
parent 0b864bef60
commit 6133707df8
Notes: github-actions[bot] 2024-08-12 13:18:09 +00:00

View file

@ -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)