diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 090df66e0d..037b28e91d 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -579,7 +579,7 @@ void QIOSInputContext::focusWindowChanged(QWindow *focusWindow) void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties) { // Mask for properties that we are interested in and see if any of them changed - updatedProperties &= (Qt::ImEnabled | Qt::ImHints | Qt::ImQueryInput | Qt::ImPlatformData); + updatedProperties &= (Qt::ImEnabled | Qt::ImHints | Qt::ImQueryInput | Qt::ImReturnKeyType | Qt::ImPlatformData); qImDebug() << "fw =" << qApp->focusWindow() << "fo =" << qApp->focusObject(); diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 5d2a675f90..4f85fb7b55 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -170,9 +170,31 @@ QVariantMap platformData = m_configuredImeState->value(Qt::ImPlatformData).toMap(); Qt::InputMethodHints hints = Qt::InputMethodHints(m_configuredImeState->value(Qt::ImHints).toUInt()); - self.returnKeyType = platformData.value(kImePlatformDataReturnKeyType).isValid() ? - UIReturnKeyType(platformData.value(kImePlatformDataReturnKeyType).toInt()) : - (hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone; + Qt::ReturnKeyType returnKeyType = Qt::ReturnKeyType(m_configuredImeState->value(Qt::ImReturnKeyType).toUInt()); + + switch (returnKeyType) { + case Qt::ReturnKeyEnter: + self.returnKeyType = UIReturnKeyDefault; + break; + case Qt::ReturnKeyDone: + self.returnKeyType = UIReturnKeyDone; + break; + case Qt::ReturnKeyGo: + self.returnKeyType = UIReturnKeyGo; + break; + case Qt::ReturnKeySend: + self.returnKeyType = UIReturnKeySend; + break; + case Qt::ReturnKeySearch: + self.returnKeyType = UIReturnKeySearch; + break; + case Qt::ReturnKeyNext: + self.returnKeyType = UIReturnKeyNext; + break; + default: + self.returnKeyType = (hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone; + break; + } self.secureTextEntry = BOOL(hints & Qt::ImhHiddenText); self.autocorrectionType = (hints & Qt::ImhNoPredictiveText) ? @@ -231,7 +253,7 @@ } // Based on what we set up in initWithInputContext above - updatedProperties &= (Qt::ImHints | Qt::ImPlatformData); + updatedProperties &= (Qt::ImHints | Qt::ImReturnKeyType | Qt::ImPlatformData); if (!updatedProperties) return NO; @@ -657,7 +679,8 @@ [self sendEventToFocusObject:press]; [self sendEventToFocusObject:release]; - if (self.returnKeyType == UIReturnKeyDone) + if (self.returnKeyType == UIReturnKeyDone || self.returnKeyType == UIReturnKeyGo + || self.returnKeyType == UIReturnKeySend || self.returnKeyType == UIReturnKeySearch) [self resignFirstResponder]; return;