qiostextresponder: Add support for ReturnKeyType
Change-Id: Ic9212468fb41d8042a345267ae69c95e0d9b4cf2 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
This commit is contained in:
parent
d47294bec7
commit
921b22e5ce
@ -579,7 +579,7 @@ void QIOSInputContext::focusWindowChanged(QWindow *focusWindow)
|
|||||||
void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
|
void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties)
|
||||||
{
|
{
|
||||||
// Mask for properties that we are interested in and see if any of them changed
|
// 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();
|
qImDebug() << "fw =" << qApp->focusWindow() << "fo =" << qApp->focusObject();
|
||||||
|
|
||||||
|
@ -170,9 +170,31 @@
|
|||||||
QVariantMap platformData = m_configuredImeState->value(Qt::ImPlatformData).toMap();
|
QVariantMap platformData = m_configuredImeState->value(Qt::ImPlatformData).toMap();
|
||||||
Qt::InputMethodHints hints = Qt::InputMethodHints(m_configuredImeState->value(Qt::ImHints).toUInt());
|
Qt::InputMethodHints hints = Qt::InputMethodHints(m_configuredImeState->value(Qt::ImHints).toUInt());
|
||||||
|
|
||||||
self.returnKeyType = platformData.value(kImePlatformDataReturnKeyType).isValid() ?
|
Qt::ReturnKeyType returnKeyType = Qt::ReturnKeyType(m_configuredImeState->value(Qt::ImReturnKeyType).toUInt());
|
||||||
UIReturnKeyType(platformData.value(kImePlatformDataReturnKeyType).toInt()) :
|
|
||||||
(hints & Qt::ImhMultiLine) ? UIReturnKeyDefault : UIReturnKeyDone;
|
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.secureTextEntry = BOOL(hints & Qt::ImhHiddenText);
|
||||||
self.autocorrectionType = (hints & Qt::ImhNoPredictiveText) ?
|
self.autocorrectionType = (hints & Qt::ImhNoPredictiveText) ?
|
||||||
@ -231,7 +253,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Based on what we set up in initWithInputContext above
|
// Based on what we set up in initWithInputContext above
|
||||||
updatedProperties &= (Qt::ImHints | Qt::ImPlatformData);
|
updatedProperties &= (Qt::ImHints | Qt::ImReturnKeyType | Qt::ImPlatformData);
|
||||||
|
|
||||||
if (!updatedProperties)
|
if (!updatedProperties)
|
||||||
return NO;
|
return NO;
|
||||||
@ -657,7 +679,8 @@
|
|||||||
[self sendEventToFocusObject:press];
|
[self sendEventToFocusObject:press];
|
||||||
[self sendEventToFocusObject:release];
|
[self sendEventToFocusObject:release];
|
||||||
|
|
||||||
if (self.returnKeyType == UIReturnKeyDone)
|
if (self.returnKeyType == UIReturnKeyDone || self.returnKeyType == UIReturnKeyGo
|
||||||
|
|| self.returnKeyType == UIReturnKeySend || self.returnKeyType == UIReturnKeySearch)
|
||||||
[self resignFirstResponder];
|
[self resignFirstResponder];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user