summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorTakumi Asaki <asaki@sra.co.jp>2014-04-25 17:14:31 +0900
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2014-08-08 10:44:29 +0200
commit8e3aacf61bcfe036acdba8fac4d07d68ff0f5ab3 (patch)
treefedd2a572282210d37a1f68f525ca1030e1d28c5 /src/widgets
parentbb760d9514ed617ee8e7344152b3fa697b2c4171 (diff)
OS X: Remove mnemonics in parentheses
In some language, mnemonics put after label text within parentheses. e.g. "&Open" is translated to "開く(&O)" in Japanese. OS X doesn't use mnemonics and '&' in label text is removed. Mnemonics in parentheses (and spaces before them) also should be removed. Change-Id: I88c0a1f60af7e148b3cf24a4e215ce807d62bce3 Reviewed-by: Tasuku Suzuki <stasuku@gmail.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 531f538820..242a1c1c9e 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -494,6 +494,18 @@ static QString qt_mac_removeMnemonics(const QString &original)
--l;
if (l == 0)
break;
+ } else if (original.at(currPos) == QLatin1Char('(') && l >= 4 &&
+ original.at(currPos + 1) == QLatin1Char('&') &&
+ original.at(currPos + 2) != QLatin1Char('&') &&
+ original.at(currPos + 3) == QLatin1Char(')')) {
+ /* remove mnemonics its format is "\s*(&X)" */
+ int n = 0;
+ while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())
+ ++n;
+ finalDest -= n;
+ currPos += 4;
+ l -= 4;
+ continue;
}
returnText[finalDest] = original.at(currPos);
++currPos;