iOS: Ignore next touch event if keyboard has lost focus during touch

If the iOS virtual keyboard as lost focus because it was slided down,
the next touch event on an inactive screen area will be mapped to the
keyboard. This kicks an assertion, because the keyboard is expected to
be visible. The case that the keyboard has been deactivated by sliding
it down is not covered.

This patch replaces the assertion by setting self.enabled to NO, which
reflects the keyboard deactivation.

Fixes: QTBUG-112246
Pick-to: 6.6 6.5 6.2
Change-Id: I4873b7a702178acfd3cb8c988134facc050d642a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Axel Spoerl 2023-04-23 13:39:02 +02:00
parent e09b1373c2
commit 58ea69aaab

View File

@ -174,7 +174,11 @@ static QUIView *focusView()
{
[super touchesBegan:touches withEvent:event];
Q_ASSERT(m_context->isInputPanelVisible());
if (!m_context->isInputPanelVisible()) {
qImDebug("keyboard was hidden by sliding it down, disabling hide-keyboard gesture");
self.enabled = NO;
return;
}
if ([touches count] != 1)
self.state = UIGestureRecognizerStateFailed;