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>
This commit is contained in:
parent
c432960718
commit
c4cfe9091e
@ -42,6 +42,7 @@
|
||||
|
||||
const char kImePlatformDataInputView[] = "inputView";
|
||||
const char kImePlatformDataInputAccessoryView[] = "inputAccessoryView";
|
||||
const char kImePlatformDataReturnKeyType[] = "returnKeyType";
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user