summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2011-12-22 19:02:34 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-02 09:04:12 +0100
commit05ca21411eaaf3ea5e9cc9d82ecfaa8753f9f319 (patch)
tree45c68b5d1d14cd18a31f501391af7e542436936e /src/gui/kernel
parent628d3f85d2d06e25851684aede396fd1b0a12db9 (diff)
Handle -1 (Invalid Key) and Qt::Key_unknown gracefully in encodeString.
Previously they would fall into the unicode handling and return very strange values. Change-Id: I62a53894c0983bf53fd79f924b40a6fd3ba02993 Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qkeysequence.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 9c0b07c64e..c17d41ba6f 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1342,6 +1342,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
{
bool nativeText = (format == QKeySequence::NativeText);
QString s;
+
+ // Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
+ if (key == -1 || key == Qt::Key_unknown)
+ return s;
+
#if defined(Q_OS_MAC)
if (nativeText) {
// On Mac OS X the order (by default) is Meta, Alt, Shift, Control.