vcl/qt5/Qt5Menu.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 5690acdb44e8017055bb88e86e19d207836bb95c
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Oct 26 23:09:24 2018 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Oct 27 02:28:05 2018 +0200

    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.wegh...@posteo.de>

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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to