From e4f546d5b0814066370a243aa22f0926a6668edc Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 7 Sep 2011 23:19:14 +0300 Subject: [PATCH] Handle ImEnabled and ImHints input method queries in QSGTextInput and QSGTextEdit Change-Id: I348f924f2987f1c163c89ce4eef18fe864ec665d Reviewed-on: http://codereview.qt-project.org/4407 Reviewed-by: Lars Knoll Reviewed-by: Qt Sanity Bot --- src/declarative/items/qsgtextedit.cpp | 16 +++++++++++++++- src/declarative/items/qsgtextinput.cpp | 4 ++++ 2 files changed, 19 insertions(+), 1 deletions(-) diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp index 1f1de8e..74f3450 100644 --- a/src/declarative/items/qsgtextedit.cpp +++ b/src/declarative/items/qsgtextedit.cpp @@ -1424,7 +1424,21 @@ Returns the value of the given \a property. QVariant QSGTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const { Q_D(const QSGTextEdit); - return d->control->inputMethodQuery(property); + + QVariant v; + switch (property) { + case Qt::ImEnabled: + v = (bool)(flags() & ItemAcceptsInputMethod); + break; + case Qt::ImHints: + v = (int)inputMethodHints(); + break; + default: + v = d->control->inputMethodQuery(property); + break; + } + return v; + } void QSGTextEdit::updateImageCache(const QRectF &) diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp index 9974094..9014cb1 100644 --- a/src/declarative/items/qsgtextinput.cpp +++ b/src/declarative/items/qsgtextinput.cpp @@ -1349,6 +1349,10 @@ QVariant QSGTextInput::inputMethodQuery(Qt::InputMethodQuery property) const { Q_D(const QSGTextInput); switch(property) { + case Qt::ImEnabled: + return QVariant((bool)(flags() & ItemAcceptsInputMethod)); + case Qt::ImHints: + return QVariant((int)inputMethodHints()); case Qt::ImMicroFocus: return cursorRectangle(); case Qt::ImFont: -- 1.7.2.5