Android: Fix for hiding cursor handles

After c80f262258 commit (which fixed
selection for read-only texts), checking if m_handleMode is Hidden was
removed. Because of that hidding cursor handle stopped work correctly.

This commit brings back check if m_handleMode is Hidden.

Also when only one handle is visible, it should be hidden within the
next 5 seconds regardless for keyboard visibility. That is how it is
handled in pure Android apps.

Pick-to: 6.6 6.5
Fixes: QTBUG-117367
Change-Id: I0400f9604234bfad7fe17d74673ae9a93088bab4
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
This commit is contained in:
Bartlomiej Moskal 2023-10-18 10:59:51 +02:00
parent e5c7bb62ee
commit 9c8651478b

View File

@ -563,6 +563,11 @@ void QAndroidInputContext::updateSelectionHandles()
bool readOnly = readOnlyVariant.toBool();
QPlatformWindow *qPlatformWindow = qGuiApp->focusWindow()->handle();
if (!readOnly && ((m_handleMode & 0xff) == Hidden)) {
QtAndroidInput::updateHandles(Hidden);
return;
}
if ( cpos == anchor && (!readOnlyVariant.isValid() || readOnly)) {
QtAndroidInput::updateHandles(Hidden);
return;
@ -589,9 +594,8 @@ void QAndroidInputContext::updateSelectionHandles()
if (!query.value(Qt::ImSurroundingText).toString().isEmpty())
buttons |= EditContext::SelectAllButton;
QtAndroidInput::updateHandles(m_handleMode, editMenuPoint, buttons, cursorPointGlobal);
// The VK is hidden, reset the timer
if (m_hideCursorHandleTimer.isActive())
m_hideCursorHandleTimer.start();
m_hideCursorHandleTimer.start();
return;
}