Android: Finish composing text before Key handling

If the sendKeyEvent was invoked, it means that the button not related
with composing text was used. In such case composing text (if it exists)
should be immediately finished.

Fixes: QTBUG-85715
Pick-to: 5.15 6.0
Change-Id: Ifbca067805b8d20f6a90f95b27210595abed964a
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
bb10
Bartlomiej Moskal 2021-01-11 11:35:47 +01:00
parent eb6e65e64a
commit 0d5b43bed4
1 changed files with 11 additions and 0 deletions

View File

@ -46,6 +46,7 @@ import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputMethodManager;
import android.view.KeyEvent;
import android.graphics.Rect;
import android.app.Activity;
import android.util.DisplayMetrics;
@ -249,6 +250,16 @@ public class QtInputConnection extends BaseInputConnection
return super.performContextMenuAction(id);
}
@Override
public boolean sendKeyEvent(KeyEvent event)
{
// QTBUG-85715
// If the sendKeyEvent was invoked, it means that the button not related with composingText was used
// In such case composing text (if it exists) should be finished immediately
finishComposingText();
return super.sendKeyEvent(event);
}
@Override
public boolean setComposingText(CharSequence text, int newCursorPosition)
{