iOS: Clear focusObject if first responder is set to null

In certain cases we were still showing a cursor in a TextInput even
though the keyboard was hidden programmatically.

Change-Id: I48ebb6b8bc0382236b1ea5835e68eae48ece2b4f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
This commit is contained in:
Markus Goetz 2015-12-14 09:58:04 +01:00 committed by Simon Hausmann
parent 8885344ad4
commit e78ca787ae

View File

@ -318,7 +318,11 @@
// a regular responder transfer to another window. In the former case, iOS
// will set the new first-responder to our next-responder, and in the latter
// case we'll have an active responder candidate.
if ([UIResponder currentFirstResponder] == [self nextResponder]) {
if (![UIResponder currentFirstResponder]) {
// No first responder set anymore, sync this with Qt by clearing the
// focus object.
m_inputContext->clearCurrentFocusObject();
} else if ([UIResponder currentFirstResponder] == [self nextResponder]) {
// We have resigned the keyboard, and transferred first responder back to the parent view
Q_ASSERT(!FirstResponderCandidate::currentCandidate());
if ([self currentImeState:Qt::ImEnabled].toBool()) {