summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/ios/qiosinputcontext.mm
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2014-12-10 16:45:45 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2014-12-11 14:39:00 +0100
commite415ed83af3b90be76c63b21ee281eb48995c2ed (patch)
tree15b2d709ec7777e7377846d5260a1fe501e02055 /src/plugins/platforms/ios/qiosinputcontext.mm
parent47326b9c5c38fea39f8539f50f32667d2c391b70 (diff)
iOS: Don't scroll screen on changes to input item transform
We auto-scroll the screen to reveal the cursor whenever the cursor rect changes or other properties of the input methods are updated, but the expected behavior when explicitly moving an item under the keyboard, such as when scrolling a view or moving an item using drag, is to not scroll the screen until typing commences. This matches how eg. Safari or the Notes app handles the same use-case. Change-Id: I6b6932d9bcbdccd8df26db982246c162f1574d86 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/ios/qiosinputcontext.mm')
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.mm22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm
index fe9ee18155..aebf8fff8f 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.mm
+++ b/src/plugins/platforms/ios/qiosinputcontext.mm
@@ -281,8 +281,6 @@ QIOSInputContext::QIOSInputContext()
if (isQtApplication()) {
QIOSScreen *iosScreen = static_cast<QIOSScreen*>(QGuiApplication::primaryScreen()->handle());
[iosScreen->uiWindow() addGestureRecognizer:m_keyboardHideGesture];
-
- connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::cursorRectangleChanged);
}
connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSInputContext::focusWindowChanged);
@@ -400,23 +398,6 @@ QRectF QIOSInputContext::keyboardRect() const
// -------------------------------------------------------------------------
-void QIOSInputContext::cursorRectangleChanged()
-{
- if (!isInputPanelVisible() || !qApp->focusObject())
- return;
-
- // Check if the cursor has changed position inside the input item. Since
- // qApp->inputMethod()->cursorRectangle() will also change when the input item
- // itself moves, we need to ask the focus object for ImCursorRectangle:
- static QPoint prevCursor;
- QInputMethodQueryEvent queryEvent(Qt::ImCursorRectangle);
- QCoreApplication::sendEvent(qApp->focusObject(), &queryEvent);
- QPoint cursor = queryEvent.value(Qt::ImCursorRectangle).toRect().topLeft();
- if (cursor != prevCursor)
- scrollToCursor();
- prevCursor = cursor;
-}
-
UIView *QIOSInputContext::scrollableRootView()
{
if (!m_keyboardHideGesture.view)
@@ -598,6 +579,9 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
} else {
[m_textResponder notifyInputDelegate:changedProperties];
}
+
+ if (changedProperties & Qt::ImCursorRectangle)
+ scrollToCursor();
}
bool QIOSInputContext::inputMethodAccepted() const