summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qkeysequence.cpp
diff options
context:
space:
mode:
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;
}
/*!