From 3f9ad1efd61c76fe0671d28aac9e4886951856ec Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 11 Apr 2014 13:46:48 +0200 Subject: Android: Reset input method when focus changes Qt Quick does not have the widgets workaround of explicitly hiding the input method on focus out. This fix copies what happens in the iOS port: Commit the current preedit and reset the IM when we see that the focus object changes. Task-number: QTBUG-38047 Change-Id: I30805265286dc650b3734e2a24807cdc8bfbcd16 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms/android/qandroidinputcontext.h') diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index f7b29a855f..3ce141ae15 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -95,6 +95,7 @@ public: bool isComposing() const; void clear(); + void setFocusObject(QObject *object); //---------------// jboolean beginBatchEdit(); @@ -136,6 +137,7 @@ private: QMetaObject::Connection m_updateCursorPosConnection; bool m_blockUpdateSelection; int m_batchEditNestingLevel; + QObject *m_focusObject; }; QT_END_NAMESPACE -- cgit v1.2.3 From 7e071cebaa731b3f635ef515627985e27726aba1 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 3 Apr 2014 15:36:27 +0200 Subject: Android input method fixes for SwiftKey Try to conform to the input method protocol in the way that SwiftKey expects (and the way that the stock android components actually do). * Refactor cursor position logic * fix getExtractedText() so it includes preedit text * ignore the hintMaxChars parameter to getExtractedText(), since it looks like everybody else does * fix setComposingRegion when preedit is active * track the start of the preedit and the preedit cursor position, since the Qt input method query does not give us this information Change-Id: I2ed8797abacd97ca749ca152fab2a2d5446ef603 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidinputcontext.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms/android/qandroidinputcontext.h') diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index 3ce141ae15..a467e4849e 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -134,6 +134,8 @@ private slots: private: ExtractedText m_extractedText; QString m_composingText; + int m_composingTextStart; + int m_composingCursor; QMetaObject::Connection m_updateCursorPosConnection; bool m_blockUpdateSelection; int m_batchEditNestingLevel; -- cgit v1.2.3