Fix QKeySequence matching

QKeySequence failed to find a match in the shortcut table when QKeyEvent
contained Qt::GroupSwitchModifier modifier. It's not a part of the shortcut,
it simply shifts character group in a keyboard mapping table.

Task-number: QTBUG-26302
Change-Id: Id91cd4999777f7085068e9dba5cb22b40653e23d
Reviewed-by: David Faure (KDE) <faure@kde.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Gatis Paeglis 2013-04-23 15:09:34 +02:00 committed by The Qt Project
parent a298216bb4
commit 7f943968ad

View File

@ -966,7 +966,7 @@ QKeyEvent::~QKeyEvent()
\sa QApplication::keyboardModifiers()
*/
//###### We must check with XGetModifierMapping
Qt::KeyboardModifiers QKeyEvent::modifiers() const
{
if (key() == Qt::Key_Shift)
@ -977,6 +977,8 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
if (key() == Qt::Key_Meta)
return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
if (key() == Qt::Key_AltGr)
return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
return QInputEvent::modifiers();
}
@ -990,10 +992,10 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
*/
bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
{
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
//The keypad and group switch modifier should not make a difference
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
const uint platform = QKeySequencePrivate::currentKeyPlatforms();
uint N = QKeySequencePrivate::numberOfKeyBindings;
int first = 0;
int last = N - 1;