QKeySequence: return Qt::Key_unknown with invalid modifiers on OS X

This also fixes the auto test, tst_QKeySequence::parseString() with
Win+A and Simon+G.

[ChangeLog][QtGui][OS X][QKeySequence] return Qt::Key_unknown with
invalid modifiers on OS X

Task-number: QTBUG-24406
Change-Id: Ie90393c9691f443c7c359cb3a487609a9691bc44
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Liang Qi 2014-01-07 08:57:34 +01:00 committed by The Qt Project
parent dbaff44ff1
commit 35f2a61426
2 changed files with 1 additions and 7 deletions

View File

@ -1075,7 +1075,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
sl = accel;
}
}
#else
#endif
int i = 0;
int lastI = 0;
while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
@ -1110,7 +1110,6 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
}
lastI = i + 1;
}
#endif
int p = accel.lastIndexOf(QLatin1Char('+'), str.length() - 2); // -2 so that Ctrl++ works
if(p > 0)

View File

@ -606,11 +606,6 @@ void tst_QKeySequence::parseString()
QFETCH( QString, strSequence );
QFETCH( QKeySequence, keycode );
#ifdef Q_OS_MAC
QEXPECT_FAIL("Win+A", "QTBUG-24406 - This test fails on OSX", Abort);
QEXPECT_FAIL("Simon+G", "QTBUG-24406 - This test fails on OSX", Abort);
#endif
QCOMPARE( QKeySequence(strSequence).toString(), keycode.toString() );
QVERIFY( QKeySequence(strSequence) == keycode );
}