diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-08-05 13:49:09 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-08-08 18:32:05 +0200 |
commit | e2e4428f0ffa79a032f56812dd89f0b8b8af63f9 (patch) | |
tree | 7acfc41882f51c8a4e1feb07806e738f19d22471 /src/plugins/platforms/ios | |
parent | 964765f686bca3ba62833e76e5ed689fce9a62bb (diff) |
iOS: ensure we close inputpanel after clearing focusobject
Change 7f72622c0f caused a regression where the input panel
would not close automatically when the focus object was
cleared. The reason is that it's apparently not enough to
just release the first responder, we also need to
explicitly tell it to release it's first responder status.
Before the failing patch, we did this from within update().
This patch will instead/in addition do an extra check from
inside reset().
Fixes: QTBUG-105323
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I00bdd44fe54db69f44232226291e3c5715935749
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.mm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index e30ccc2c84..4c4b213ba2 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -712,11 +712,20 @@ void QIOSInputContext::reset() // Instead, we choose to recreate the text responder as a brute-force solution // until we have better knowledge of what is going on (or implement the new // UITextInteraction protocol). + const auto oldResponder = m_textResponder; [m_textResponder reset]; [m_textResponder autorelease]; m_textResponder = nullptr; update(Qt::ImQueryAll); + + // If update() didn't end up creating a new text responder, oldResponder will still be + // the first responder. In that case we need to resign it, so that the input panel hides. + // (the input panel will apparently not hide if the first responder is only released). + if ([oldResponder isFirstResponder]) { + qImDebug("IM not enabled, resigning autoreleased text responder as first responder"); + [oldResponder resignFirstResponder]; + } } /*! |