summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qkeysequence.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-11 17:19:29 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-11 17:19:29 (GMT)
commit8c13e18eb49ab9ab42db4359f0ccc91de5c72818 (patch)
tree17dbc029e37835594ad29d586f3fc7ec8013b65a /src/gui/kernel/qkeysequence.cpp
parentde76200652e05de34d99f111c64a051a49911034 (diff)
parent2d63f8fe5b77747014e1c5807c9d457611bd9304 (diff)
downloadQt-8c13e18eb49ab9ab42db4359f0ccc91de5c72818.zip
Qt-8c13e18eb49ab9ab42db4359f0ccc91de5c72818.tar.gz
Qt-8c13e18eb49ab9ab42db4359f0ccc91de5c72818.tar.bz2
Merge commit 'widget/4.6' into oslo-staging-2/4.6
Conflicts: src/gui/painting/qbrush.cpp
Diffstat (limited to 'src/gui/kernel/qkeysequence.cpp')
-rw-r--r--src/gui/kernel/qkeysequence.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 1a76083..89c18fb 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1014,9 +1014,12 @@ bool QKeySequence::isEmpty() const
*/
QKeySequence QKeySequence::mnemonic(const QString &text)
{
+ QKeySequence ret;
+
if(qt_sequence_no_mnemonics)
- return QKeySequence();
+ return ret;
+ bool found = false;
int p = 0;
while (p >= 0) {
p = text.indexOf(QLatin1Char('&'), p) + 1;
@@ -1025,13 +1028,22 @@ QKeySequence QKeySequence::mnemonic(const QString &text)
if (text.at(p) != QLatin1Char('&')) {
QChar c = text.at(p);
if (c.isPrint()) {
- c = c.toUpper();
- return QKeySequence(c.unicode() + Qt::ALT);
+ if (!found) {
+ c = c.toUpper();
+ ret = QKeySequence(c.unicode() + Qt::ALT);
+#ifdef QT_NO_DEBUG
+ return ret;
+#else
+ found = true;
+ } else {
+ qWarning(qPrintable(QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(text)));
+#endif
+ }
}
}
p++;
}
- return QKeySequence();
+ return ret;
}
/*!