summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kdab.com>2017-12-13 15:00:36 +0200
committerBogDan Vatra <bogdan@kdab.com>2018-01-27 09:36:25 +0000
commit6b1ecb1904c3f7281d90e672971f23d54bb76600 (patch)
treebc3cfa7b33544c7a36a6a7ed3dc0054c8b0e9472
parentb1a58b20ae109fac2756101fea4dcd8ee0b96531 (diff)
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 <paul.tvete@qt.io>
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp10
1 files changed, 10 insertions, 0 deletions
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()