ibus: send batched QInputMethodQueryEvent event

Change-Id: Idc537a497569d86bb63776934d5e0bbbc39291be
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Gatis Paeglis 2019-01-02 21:54:31 +01:00
parent fe63900dc9
commit 0c54e0251f

View File

@ -217,17 +217,14 @@ void QIBusPlatformInputContext::update(Qt::InputMethodQueries q)
&& (q.testFlag(Qt::ImSurroundingText)
|| q.testFlag(Qt::ImCursorPosition)
|| q.testFlag(Qt::ImAnchorPosition))) {
QInputMethodQueryEvent srrndTextQuery(Qt::ImSurroundingText);
QInputMethodQueryEvent cursorPosQuery(Qt::ImCursorPosition);
QInputMethodQueryEvent anchorPosQuery(Qt::ImAnchorPosition);
QCoreApplication::sendEvent(input, &srrndTextQuery);
QCoreApplication::sendEvent(input, &cursorPosQuery);
QCoreApplication::sendEvent(input, &anchorPosQuery);
QInputMethodQueryEvent query(Qt::ImSurroundingText | Qt::ImCursorPosition | Qt::ImAnchorPosition);
QString surroundingText = srrndTextQuery.value(Qt::ImSurroundingText).toString();
uint cursorPosition = cursorPosQuery.value(Qt::ImCursorPosition).toUInt();
uint anchorPosition = anchorPosQuery.value(Qt::ImAnchorPosition).toUInt();
QCoreApplication::sendEvent(input, &query);
QString surroundingText = query.value(Qt::ImSurroundingText).toString();
uint cursorPosition = query.value(Qt::ImCursorPosition).toUInt();
uint anchorPosition = query.value(Qt::ImAnchorPosition).toUInt();
QIBusText text;
text.text = surroundingText;