Remove text selection handles when keyboard is hidden

Task-number: QTBUG-58700
Change-Id: I094f31250ec879b0f08f27499794946cac2084e6
Reviewed-by: Corey Pendleton <corey.pendleton@garmin.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
bb10
BogDan Vatra 2017-12-15 15:31:00 +02:00
parent 288a2ada5b
commit f6fd8dceea
3 changed files with 13 additions and 1 deletions

View File

@ -805,8 +805,10 @@ namespace QtAndroidInput
QAndroidInputContext *inputContext = QAndroidInputContext::androidInputContext();
if (inputContext && qGuiApp) {
inputContext->emitInputPanelVisibleChanged();
if (!visibility)
if (!visibility) {
inputContext->emitKeyboardRectChanged();
QMetaObject::invokeMethod(inputContext, "hideSelectionHandles", Qt::QueuedConnection);
}
}
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
qDebug() << "@@@ KEYBOARDVISIBILITYCHANGED" << inputContext;

View File

@ -593,6 +593,7 @@ void QAndroidInputContext::updateSelectionHandles()
return;
}
m_handleMode |= ShowSelection;
auto leftRect = im->cursorRectangle();
auto rightRect = im->anchorRectangle();
if (cpos > anchor)
@ -741,6 +742,14 @@ void QAndroidInputContext::keyDown()
}
}
void QAndroidInputContext::hideSelectionHandles()
{
if (m_handleMode & ShowSelection) {
m_handleMode = Hidden;
updateSelectionHandles();
}
}
void QAndroidInputContext::update(Qt::InputMethodQueries queries)
{
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe(queries);

View File

@ -132,6 +132,7 @@ public slots:
void touchDown(int x, int y);
void longPress(int x, int y);
void keyDown();
void hideSelectionHandles();
private slots:
void showInputPanelLater(Qt::ApplicationState);