diff options
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.mm | 22 |
2 files changed, 3 insertions, 20 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index 863e503c3b..498db45ef2 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -96,7 +96,6 @@ public: void setFocusObject(QObject *object) Q_DECL_OVERRIDE; void focusWindowChanged(QWindow *focusWindow); - void cursorRectangleChanged(); void scrollToCursor(); void scroll(int y); 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 |