QWidgetTextControl: ignore invalid input method event

to avoid update the text document.

Fixes: QTBUG-112953
Pick-to: 6.5 6.2 5.15
Change-Id: Ib72de57133314e4eb38a15758b8318d901196d75
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
bb10
Liang Qi 2023-04-19 13:23:10 +02:00
parent 8c0aafc237
commit 70f064f270
1 changed files with 5 additions and 0 deletions

View File

@ -2032,6 +2032,11 @@ void QWidgetTextControlPrivate::inputMethodEvent(QInputMethodEvent *e)
|| e->preeditString() != cursor.block().layout()->preeditAreaText()
|| e->replacementLength() > 0;
if (!isGettingInput && e->attributes().isEmpty()) {
e->ignore();
return;
}
int oldCursorPos = cursor.position();
cursor.beginEditBlock();