summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosinputcontext.mm
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-01-15 10:40:13 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-06 14:19:44 +0100
commit7eb8b67c8bc8e69b3dd6fb39dde09ac36f56e538 (patch)
tree1bdfb761e9fddd142e1d3e9ec3c4b6c90e6e0e78 /src/plugins/platforms/ios/qiosinputcontext.mm
parente60357fa9efcc20f48a9ef93230fadf4c58d6a39 (diff)
iOS: implement support for input methods
This change will add support for input methods, word completion, spell checking and related functionality. Change-Id: I41d4de1cab521c679d414cfc7c1a2d0f9c1fcaaf Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosinputcontext.mm')
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index c25d76518f..15f5082f62 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -42,6 +42,7 @@
#include "qiosglobal.h"
#include "qiosinputcontext.h"
#include "qioswindow.h"
+#include "quiview.h"
#include <QGuiApplication>
@interface QIOSKeyboardListener : NSObject {
@@ -228,23 +229,12 @@ void QIOSInputContext::setFocusObject(QObject *focusObject)
{
m_focusObject = focusObject;
- if (!m_focusView || !m_focusView.isFirstResponder) {
+ if (!focusObject || !m_focusView || !m_focusView.isFirstResponder) {
scroll(0);
return;
}
- // Since m_focusView is the first responder, it means that the keyboard is open and we
- // should update keyboard layout. But there seem to be no way to tell it to reread the
- // UITextInputTraits from m_focusView. To work around that, we quickly resign first
- // responder status just to reassign it again. To not remove the focusObject in the same
- // go, we need to call the super implementation of resignFirstResponder. Since the call
- // will cause a 'keyboardWillHide' notification to be sendt, we also block scrollRootView
- // to avoid artifacts:
- m_keyboardListener->m_ignoreKeyboardChanges = true;
- SEL sel = @selector(resignFirstResponder);
- [[m_focusView superclass] instanceMethodForSelector:sel](m_focusView, sel);
- [m_focusView becomeFirstResponder];
- m_keyboardListener->m_ignoreKeyboardChanges = false;
+ reset();
if (m_keyboardListener->m_keyboardVisibleAndDocked)
scrollToCursor();
@@ -252,8 +242,7 @@ void QIOSInputContext::setFocusObject(QObject *focusObject)
void QIOSInputContext::focusWindowChanged(QWindow *focusWindow)
{
- UIView<UIKeyInput> *view = focusWindow ?
- reinterpret_cast<UIView<UIKeyInput> *>(focusWindow->handle()->winId()) : 0;
+ QUIView *view = focusWindow ? reinterpret_cast<QUIView *>(focusWindow->handle()->winId()) : 0;
if ([m_focusView isFirstResponder])
[view becomeFirstResponder];
[m_focusView release];
@@ -315,3 +304,22 @@ void QIOSInputContext::scroll(int y)
completion:0];
}
+void QIOSInputContext::update(Qt::InputMethodQueries query)
+{
+ [m_focusView updateInputMethodWithQuery:query];
+}
+
+void QIOSInputContext::reset()
+{
+ // Since the call to reset will cause a 'keyboardWillHide'
+ // notification to be sendt, we block keyboard nofifications to avoid artifacts:
+ m_keyboardListener->m_ignoreKeyboardChanges = true;
+ [m_focusView reset];
+ m_keyboardListener->m_ignoreKeyboardChanges = false;
+}
+
+void QIOSInputContext::commit()
+{
+ [m_focusView commit];
+}
+