diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2023-04-23 13:39:02 +0200 |
---|---|---|
committer | Axel Spoerl <axel.spoerl@qt.io> | 2023-06-08 16:25:59 +0000 |
commit | 58ea69aaab62f31247dcd9b12f55de8fc001ea3a (patch) | |
tree | 01b5711ce867f42d06e020d068c646c98474ce79 | |
parent | e09b1373c2b761f20cd930f95119306d59068c80 (diff) |
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>
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.mm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 7a76760638..ac482226e9 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -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; |