Skip to content

Commit

Permalink
Make editors commit preedit themselves on losing focus
Browse files Browse the repository at this point in the history
Change-Id: I1d42a8804068718c7347b4f652289f9724c25a3c
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
  • Loading branch information
Pekka Vuorela authored and Qt by Nokia committed Dec 20, 2011
1 parent a231d3c commit 9697e2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/qtquick1/graphicsitems/qdeclarativetextinput.cpp
Expand Up @@ -1065,8 +1065,10 @@ void QDeclarative1TextInputPrivate::focusChanged(bool hasFocus)
q->setCursorVisible(hasFocus && scene && scene->hasFocus());
if(!hasFocus && control->passwordEchoEditing())
control->updatePasswordEchoEditing(false);//QWidgetLineControl sets it on key events, but doesn't deal with focus events
if (!hasFocus)
if (!hasFocus) {
control->commitPreedit();
control->deselect();
}
QDeclarativeItemPrivate::focusChanged(hasFocus);
}

Expand Down
4 changes: 2 additions & 2 deletions src/quick/items/qquickcanvas.cpp
Expand Up @@ -383,7 +383,7 @@ void QQuickCanvasPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, F

if (oldActiveFocusItem) {
#ifndef QT_NO_IM
qApp->inputPanel()->commit();
qApp->inputPanel()->reset();
#endif

activeFocusItem = 0;
Expand Down Expand Up @@ -492,7 +492,7 @@ void QQuickCanvasPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
Q_ASSERT(oldActiveFocusItem);

#ifndef QT_NO_IM
qApp->inputPanel()->commit();
qApp->inputPanel()->reset();
#endif

activeFocusItem = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/quick/items/qquicktextinput.cpp
Expand Up @@ -2004,8 +2004,11 @@ void QQuickTextInput::itemChange(ItemChange change, const ItemChangeData &value)
#endif
d->updatePasswordEchoEditing(false);//QQuickTextInputPrivate sets it on key events, but doesn't deal with focus events
}
if (!hasFocus)

if (!hasFocus) {
d->commitPreedit();
d->deselect();
}
}
QQuickItem::itemChange(change, value);
}
Expand Down

0 comments on commit 9697e2a

Please sign in to comment.