summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2018-10-26 23:09:24 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2018-10-27 02:28:05 +0200
commit5690acdb44e8017055bb88e86e19d207836bb95c (patch)
tree5a58930b4d94a0785cc4d220c6eeac2bffe5acc1
parent5d2ab49cbda1d7aea1019478abe0163e1f40a121 (diff)
tdf#120453 Preserve literal '&' in Qt menu texts
As described in the QMenuBar documentation, a single ampersand in a menu item text is used to set the shortcut for the menu, while "&&" is used to get a real ampersand character. Change-Id: Idf510641c8919ff8223114413851cb3ee7d7b4a2 Reviewed-on: https://gerrit.libreoffice.org/62405 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/qt5/Qt5Menu.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 51fcdf709bc4..17578ef4ce24 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -250,7 +250,13 @@ void Qt5Menu::slotMenuTriggered(Qt5MenuItem* pQItem)
}
}
-void Qt5Menu::NativeItemText(OUString& rItemText) { rItemText = rItemText.replace('~', '&'); }
+void Qt5Menu::NativeItemText(OUString& rItemText)
+{
+ // preserve literal '&'s in menu texts
+ rItemText = rItemText.replaceAll("&", "&&");
+
+ rItemText = rItemText.replace('~', '&');
+}
Qt5MenuItem::Qt5MenuItem(const SalItemParams* pItemData)
: mpParentMenu(nullptr)