Android: Use proper empty strings in key events
A key event with no unicode would get a text of "\0" instead of the empty string. This would lead to various widgets interpreting the Key_Back event as text input, meaning that it would be grabbed by the widget instead of being propagated. Task-number: QTBUG-35784 Change-Id: Ibdb0e491572e41dd1aaf3b03ae1a780731f0559a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
1567699c0e
commit
80d4a19f51
@ -517,6 +517,12 @@ namespace QtAndroidInput
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// maps 0 to the empty string, and anything else to a single-character string
|
||||||
|
static inline QString toString(jint unicode)
|
||||||
|
{
|
||||||
|
return unicode ? QString(QChar(unicode)) : QString();
|
||||||
|
}
|
||||||
|
|
||||||
static void keyDown(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier)
|
static void keyDown(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier)
|
||||||
{
|
{
|
||||||
Qt::KeyboardModifiers modifiers;
|
Qt::KeyboardModifiers modifiers;
|
||||||
@ -533,7 +539,7 @@ namespace QtAndroidInput
|
|||||||
QEvent::KeyPress,
|
QEvent::KeyPress,
|
||||||
mapAndroidKey(key),
|
mapAndroidKey(key),
|
||||||
modifiers,
|
modifiers,
|
||||||
QChar(unicode),
|
toString(unicode),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +559,7 @@ namespace QtAndroidInput
|
|||||||
QEvent::KeyRelease,
|
QEvent::KeyRelease,
|
||||||
mapAndroidKey(key),
|
mapAndroidKey(key),
|
||||||
modifiers,
|
modifiers,
|
||||||
QChar(unicode),
|
toString(unicode),
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user