From 6b1ecb1904c3f7281d90e672971f23d54bb76600 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 13 Dec 2017 15:00:36 +0200 Subject: Android: Hide handler(s) if the cursor is not visible anymore On Android if the edit control is bigger than the remaining screen we resize it, this caused the handler(s) to remain outside the control. A better fix will be to ensure that the cursor/selection remains visible when the control is resized but I don't know if this is the desired behavior on all platforms. Task-number: QTBUG-62994 Task-number: QTBUG-58700 Change-Id: If43eb7bc1ecde426697694a8f26118e95fccb80c Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/android/qandroidinputcontext.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index fe4c5be4cb..fb33ad6e21 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -438,6 +438,16 @@ QAndroidInputContext::QAndroidInputContext() QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QAndroidInputContext::updateSelectionHandles); + QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::anchorRectangleChanged, + this, &QAndroidInputContext::updateSelectionHandles); + QObject::connect(QGuiApplication::inputMethod(), &QInputMethod::inputItemClipRectangleChanged, this, [this]{ + auto im = qGuiApp->inputMethod(); + if (!im->inputItemClipRectangle().contains(im->anchorRectangle()) || + !im->inputItemClipRectangle().contains(im->cursorRectangle())) { + m_cursorHandleShown = CursorHandleNotShown; + updateSelectionHandles(); + } + }); } QAndroidInputContext::~QAndroidInputContext() -- cgit v1.2.3