diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-06-22 06:54:02 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-06-22 06:54:02 (GMT) |
commit | 70aab1578e1822f4571f7b13841603fc4ceef0f6 (patch) | |
tree | 2fb1aa4e6c1dde9842740e9799bca274d912f02f /src/declarative/graphicsitems/qdeclarativetextinput.cpp | |
parent | 1b263458966dbf8aca5dc64218b726a74c4ff581 (diff) | |
download | Qt-70aab1578e1822f4571f7b13841603fc4ceef0f6.zip Qt-70aab1578e1822f4571f7b13841603fc4ceef0f6.tar.gz Qt-70aab1578e1822f4571f7b13841603fc4ceef0f6.tar.bz2 |
Handle TextInput inputMethodEvent() properly
Follow the pattern of other text input classes and QML key handling
classes.
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextinput.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextinput.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 9e5dfb5..ec14c78 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -913,6 +913,22 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) QDeclarativePaintedItem::keyPressEvent(ev); } +void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev) +{ + Q_D(QDeclarativeTextInput); + inputMethodPreHandler(ev); + if (ev->isAccepted()) + return; + if (d->control->isReadOnly()) { + ev->ignore(); + } else { + d->control->processInputMethodEvent(ev); + updateSize(); + } + if (!ev->isAccepted()) + QDeclarativePaintedItem::inputMethodEvent(ev); +} + /*! \overload Handles the given mouse \a event. @@ -993,6 +1009,7 @@ bool QDeclarativeTextInput::event(QEvent* ev) switch(ev->type()){ case QEvent::KeyPress: case QEvent::KeyRelease://###Should the control be doing anything with release? + case QEvent::InputMethod: case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: case QEvent::GraphicsSceneMouseRelease: @@ -1000,8 +1017,6 @@ bool QDeclarativeTextInput::event(QEvent* ev) break; default: handled = d->control->processEvent(ev); - if (ev->type() == QEvent::InputMethod) - updateSize(); } if(!handled) handled = QDeclarativePaintedItem::event(ev); |