diff options
author | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-10-28 10:42:56 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@digia.com> | 2014-11-03 18:46:34 +0100 |
commit | c4cfe9091e4f2e4b3054718a4b876413b48e1563 (patch) | |
tree | 586b7e944ab61591bd51b88a596f0596741039ce /src/plugins/platforms/ios | |
parent | c432960718de8afb43512f35d5339b3a5b8ead2c (diff) |
iOS: Allow virtual keyboard returnKeyType to be set through IM platformData
The result of pressing the key is still a Qt::Key_Return press/release
sequence, which needs to be handled manually.
Change-Id: I72c7b0067bd3ec1bc315ab2c84361800b7be0943
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: Marius Bugge Monsen <marius@cutehacks.com>
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r-- | src/plugins/platforms/ios/qiosinputcontext.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiostextresponder.mm | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index 46fe35d884..5791367d84 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -42,6 +42,7 @@ const char kImePlatformDataInputView[] = "inputView"; const char kImePlatformDataInputAccessoryView[] = "inputAccessoryView"; +const char kImePlatformDataReturnKeyType[] = "returnKeyType"; QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index b809fc4b51..e3c73f5222 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -173,9 +173,13 @@ m_inSendEventToFocusObject = NO; m_inputContext = inputContext; + QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap(); Qt::InputMethodHints hints = Qt::InputMethodHints([self imValue:Qt::ImHints].toUInt()); - self.returnKeyType = (hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone; + self.returnKeyType = platformData.value(kImePlatformDataReturnKeyType).isValid() ? + UIReturnKeyType(platformData.value(kImePlatformDataReturnKeyType).toInt()) : + (hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone; + self.secureTextEntry = BOOL(hints & Qt::ImhHiddenText); self.autocorrectionType = (hints & Qt::ImhNoPredictiveText) ? UITextAutocorrectionTypeNo : UITextAutocorrectionTypeDefault; @@ -202,7 +206,6 @@ else self.keyboardType = UIKeyboardTypeDefault; - QVariantMap platformData = [self imValue:Qt::ImPlatformData].toMap(); if (UIView *inputView = static_cast<UIView *>(platformData.value(kImePlatformDataInputView).value<void *>())) self.inputView = [[[WrapperView alloc] initWithView:inputView] autorelease]; if (UIView *accessoryView = static_cast<UIView *>(platformData.value(kImePlatformDataInputAccessoryView).value<void *>())) @@ -625,8 +628,7 @@ [self sendEventToFocusObject:press]; [self sendEventToFocusObject:release]; - Qt::InputMethodHints imeHints = static_cast<Qt::InputMethodHints>([self imValue:Qt::ImHints].toUInt()); - if (!(imeHints & Qt::ImhMultiLine)) + if (self.returnKeyType == UIReturnKeyDone) [self resignFirstResponder]; return; |