qqnxinputcontext: Add support for EnterKeyType
Change-Id: I03b9d70b9bb05cd28fdcbb076764a2e1d9e3e0e3 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
parent
49f7281d36
commit
287e944def
@ -124,4 +124,25 @@ void QQnxAbstractVirtualKeyboard::setLocale(const QLocale &locale)
|
|||||||
emit localeChanged(locale);
|
emit localeChanged(locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QQnxAbstractVirtualKeyboard::EnterKeyType
|
||||||
|
QQnxAbstractVirtualKeyboard::qtEnterKeyTypeToQnx(Qt::EnterKeyType type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case Qt::EnterKeyDone:
|
||||||
|
return Done;
|
||||||
|
case Qt::EnterKeyGo:
|
||||||
|
return Go;
|
||||||
|
case Qt::EnterKeyNext:
|
||||||
|
return Next;
|
||||||
|
case Qt::EnterKeySearch:
|
||||||
|
return Search;
|
||||||
|
case Qt::EnterKeySend:
|
||||||
|
return Send;
|
||||||
|
case Qt::EnterKeyDefault:
|
||||||
|
case Qt::EnterKeyReturn:
|
||||||
|
case Qt::EnterKeyPrevious: // unsupported
|
||||||
|
return DefaultReturn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -74,6 +74,8 @@ public:
|
|||||||
KeyboardMode keyboardMode() const { return m_keyboardMode; }
|
KeyboardMode keyboardMode() const { return m_keyboardMode; }
|
||||||
EnterKeyType enterKeyType() const { return m_enterKeyType; }
|
EnterKeyType enterKeyType() const { return m_enterKeyType; }
|
||||||
|
|
||||||
|
static EnterKeyType qtEnterKeyTypeToQnx(Qt::EnterKeyType type);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void heightChanged(int height);
|
void heightChanged(int height);
|
||||||
void visibilityChanged(bool visible);
|
void visibilityChanged(bool visible);
|
||||||
|
@ -1384,13 +1384,17 @@ void QQnxInputContext::setFocusObject(QObject *object)
|
|||||||
if (hasSession())
|
if (hasSession())
|
||||||
dispatchFocusLossEvent();
|
dispatchFocusLossEvent();
|
||||||
} else {
|
} else {
|
||||||
QInputMethodQueryEvent query(Qt::ImHints);
|
QInputMethodQueryEvent query(Qt::ImHints | Qt::ImEnterKeyType);
|
||||||
QCoreApplication::sendEvent(object, &query);
|
QCoreApplication::sendEvent(object, &query);
|
||||||
int inputHints = query.value(Qt::ImHints).toInt();
|
int inputHints = query.value(Qt::ImHints).toInt();
|
||||||
|
Qt::EnterKeyType qtEnterKeyType = Qt::EnterKeyType(query.value(Qt::ImEnterKeyType).toInt());
|
||||||
|
|
||||||
dispatchFocusGainEvent(inputHints);
|
dispatchFocusGainEvent(inputHints);
|
||||||
|
|
||||||
m_virtualKeyboard.setInputHints(inputHints);
|
m_virtualKeyboard.setInputHints(inputHints);
|
||||||
|
m_virtualKeyboard.setEnterKeyType(
|
||||||
|
QQnxAbstractVirtualKeyboard::qtEnterKeyTypeToQnx(qtEnterKeyType)
|
||||||
|
);
|
||||||
|
|
||||||
if (!m_inputPanelVisible)
|
if (!m_inputPanelVisible)
|
||||||
showInputPanel();
|
showInputPanel();
|
||||||
|
@ -172,11 +172,15 @@ void QQnxInputContext::setFocusObject(QObject *object)
|
|||||||
if (m_inputPanelVisible)
|
if (m_inputPanelVisible)
|
||||||
hideInputPanel();
|
hideInputPanel();
|
||||||
} else {
|
} else {
|
||||||
QInputMethodQueryEvent query(Qt::ImHints);
|
QInputMethodQueryEvent query(Qt::ImHints | Qt::ImEnterKeyType);
|
||||||
QCoreApplication::sendEvent(object, &query);
|
QCoreApplication::sendEvent(object, &query);
|
||||||
int inputHints = query.value(Qt::ImHints).toInt();
|
int inputHints = query.value(Qt::ImHints).toInt();
|
||||||
|
Qt::EnterKeyType qtEnterKeyType = Qt::EnterKeyType(query.value(Qt::ImEnterKeyType).toInt());
|
||||||
|
|
||||||
m_virtualKeyboard.setInputHints(inputHints);
|
m_virtualKeyboard.setInputHints(inputHints);
|
||||||
|
m_virtualKeyboard.setEnterKeyType(
|
||||||
|
QQnxAbstractVirtualKeyboard::qtEnterKeyTypeToQnx(qtEnterKeyType)
|
||||||
|
);
|
||||||
|
|
||||||
if (!m_inputPanelVisible)
|
if (!m_inputPanelVisible)
|
||||||
showInputPanel();
|
showInputPanel();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user