summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosinputcontext.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-10-27 16:11:58 +0100
committerTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-11-06 12:26:06 +0100
commit30d9498329489020f1720841ac960e06e2e7c5e4 (patch)
tree0c4699d4197c46a809378311eb8f2838cfe6750a /src/plugins/platforms/ios/qiosinputcontext.mm
parent9c8943a862a5762eef0ae98f2b6b14e5c449105c (diff)
iOS: Detect when inputMethodAccepted() is out of sync with focus object
The GraphicsView stack still seems to have issues emitting focusObject change signals when the focus object changes inside the item hierarchy. To be on the safe side we use our own view of whether or not IM is enabled, and try to detect and warn if we find a case where the two are out of sync. Change-Id: I9fde896ea14ea5b65784723110887e06453edbd4 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosinputcontext.mm')
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index c038628fd9..25d9f6c421 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -486,6 +486,26 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
}
}
+bool QIOSInputContext::inputMethodAccepted() const
+{
+ // The IM enablement state is based on the last call to update()
+ bool lastKnownImEnablementState = m_imeState.currentState.value(Qt::ImEnabled).toBool();
+
+#if !defined(QT_NO_DEBUG)
+ // QPlatformInputContext keeps a cached value of the current IM enablement state that is
+ // updated by QGuiApplication when the current focus object changes, or by QInputMethod's
+ // update() function. If the focus object changes, but the change is not propagated as
+ // a signal to QGuiApplication due to bugs in the widget/graphicsview/qml stack, we'll
+ // end up with a stale value for QPlatformInputContext::inputMethodAccepted(). To be on
+ // the safe side we always use our own cached value to decide if IM is enabled, and try
+ // to detect the case where the two values are out of sync.
+ if (lastKnownImEnablementState != QPlatformInputContext::inputMethodAccepted())
+ qWarning("QPlatformInputContext::inputMethodAccepted() does not match actual focus object IM enablement!");
+#endif
+
+ return lastKnownImEnablementState;
+}
+
/*!
Called by the input item to reset the input method state.
*/