Android: Set correct input hints when queried through getCursorCapsMode

getCursorCapsMode() now matches the Java implementation in
QtActivityDelegate.showSoftwareKeyboard() which is given to the Android
keyboard on InputConnection creation.

The reason we only saw this bug with some Android keyboards was that many
keyboards never call getCursorCapsMode and just rely on the initial hints.

Task-number: QTBUG-51865
Change-Id: I2aae024d9c77ea14e087e3f51a413d15a684179c
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2017-12-14 13:15:05 +01:00 committed by Johan Helsing
parent f2f75c0228
commit 034e92b0f4

View File

@ -847,11 +847,11 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/)
const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt();
if (qtInputMethodHints & Qt::ImhPreferUppercase)
res = CAP_MODE_SENTENCES;
if (!(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase))
res |= CAP_MODE_SENTENCES;
if (qtInputMethodHints & Qt::ImhUppercaseOnly)
res = CAP_MODE_CHARACTERS;
res |= CAP_MODE_CHARACTERS;
return res;
}