From ac22379a75b2e252ae0fe6fe2585e3beb2096be9 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Mon, 25 Jul 2011 15:48:01 +1000 Subject: Emit selectionChanged signals when input method alters the selection. Check if the input method removes the selection and force emit selectionChanged if it sets a new selection. Task-number: QTBUG-19727 Reviewed-by: Martin Jones Change-Id: Ic8ea1044d0917aac4e52368f431ac9e5c7db7c56 Reviewed-on: http://codereview.qt.nokia.com/2076 Reviewed-by: Qt Sanity Bot Reviewed-by: Andrew den Exter --- src/gui/text/qtextcontrol.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index aacac0445c..424d1979b2 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1918,6 +1918,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) bool isGettingInput = !e->commitString().isEmpty() || e->preeditString() != cursor.block().layout()->preeditAreaText() || e->replacementLength() > 0; + bool forceSelectionChanged = false; cursor.beginEditBlock(); if (isGettingInput) { @@ -1941,6 +1942,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) cursor.setPosition(blockStart + a.length, QTextCursor::KeepAnchor); q->ensureCursorVisible(); repaintOldAndNewSelection(oldCursor); + forceSelectionChanged = true; } } @@ -1974,6 +1976,7 @@ void QTextControlPrivate::inputMethodEvent(QInputMethodEvent *e) cursor.d->setX(); if (oldPreeditCursor != preeditCursor) emit q->microFocusChanged(); + selectionChanged(forceSelectionChanged); } QVariant QTextControl::inputMethodQuery(Qt::InputMethodQuery property) const -- cgit v1.2.3