macOS: Fix handling of multiple ampersands in menu items

If the text of a QAction in a menu item contained a sequence of multiple
ampersand characters, only one of them would be removed, which is
inconsistent with the way this situation is handled on Windows, where
every other ampersand is removed, which is also the way other widgets
such as tabs, buttons, etc. are handled on macOS and other platforms.

Task-number: QTBUG-63361
Change-Id: Ibd9a520afa37b3387f3b951a94a3c275742e7ad3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Andre de la Rocha 2017-11-26 22:22:25 +01:00
parent 0e5d1bb3e4
commit 2c062546a2
2 changed files with 2 additions and 4 deletions

View File

@ -747,8 +747,7 @@ QString QPlatformTheme::removeMnemonics(const QString &original)
int currPos = 0;
int l = original.length();
while (l) {
if (original.at(currPos) == QLatin1Char('&')
&& (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
if (original.at(currPos) == QLatin1Char('&')) {
++currPos;
--l;
if (l == 0)

View File

@ -596,8 +596,7 @@ static QString qt_mac_removeMnemonics(const QString &original)
int currPos = 0;
int l = original.length();
while (l) {
if (original.at(currPos) == QLatin1Char('&')
&& (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
if (original.at(currPos) == QLatin1Char('&')) {
++currPos;
--l;
if (l == 0)