summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qkeysequence.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:24:34 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-02-11 08:25:04 +0100
commitd456f87ece0323982b7601047712545ab95426ad (patch)
tree46b90468b01144615f280620d73763fc189d25ac /src/gui/kernel/qkeysequence.cpp
parentcc2938b5b6aa07210b04bd48ad8a2830701a06e5 (diff)
parent4fc070a4192d5b914b6f814a8dcab3f552d9abac (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qfilesystemwatcher_win.cpp src/corelib/plugin/plugin.pri src/plugins/platforms/cocoa/qcocoaaccessibility.mm tests/auto/corelib/tools/qlocale/tst_qlocale.cpp Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
Diffstat (limited to 'src/gui/kernel/qkeysequence.cpp')
-rw-r--r--src/gui/kernel/qkeysequence.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 38cc9506ee..c23dbbb3be 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1267,7 +1267,28 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
if ((key & Qt::KeypadModifier) == Qt::KeypadModifier)
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Num") : QString::fromLatin1("Num"), format);
+ QString p = keyName(key, format);
+#if defined(Q_OS_OSX)
+ if (nativeText)
+ s += p;
+ else
+#endif
+ addKey(s, p, format);
+ return s;
+}
+
+/*!
+ \internal
+ Returns the text representation of the key \a key, which can be used i.e.
+ when the sequence is serialized. This does not take modifiers into account
+ (see encodeString() for a version that does).
+
+ This static method is used by encodeString() and by the D-Bus menu exporter.
+*/
+QString QKeySequencePrivate::keyName(int key, QKeySequence::SequenceFormat format)
+{
+ bool nativeText = (format == QKeySequence::NativeText);
key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier);
QString p;
@@ -1318,14 +1339,7 @@ NonSymbol:
}
}
}
-
-#if defined(Q_OS_MACX)
- if (nativeText)
- s += p;
- else
-#endif
- addKey(s, p, format);
- return s;
+ return p;
}
/*!
Matches the sequence with \a seq. Returns ExactMatch if