summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre de la Rocha <andre.rocha@qt.io>2017-11-26 22:22:25 +0100
committerAndre de la Rocha <andre.rocha@qt.io>2017-11-30 12:54:00 +0000
commit2c062546a21edc68ded82b7b852df3c993d332e0 (patch)
tree7de2c93f574ac801f31249e22e82d07b79056b69
parent0e5d1bb3e4182c16346856cc14576efa0dfda453 (diff)
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>
-rw-r--r--src/gui/kernel/qplatformtheme.cpp3
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm3
2 files changed, 2 insertions, 4 deletions
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index cd3966fb47..c8ba86bc9a 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -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)
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index c6ae7c1b79..2067c86023 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -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)