summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-02-08 03:43:19 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2011-02-09 00:19:48 (GMT)
commitf7e789710568d263816f50bd5782cc7adec41249 (patch)
treeb267e8889b36d5e53802134791ab97d0e6444db8 /src/gui/graphicsview
parentdd49b322b327fe87d8420abcce0e6cee877a88d7 (diff)
downloadQt-f7e789710568d263816f50bd5782cc7adec41249.zip
Qt-f7e789710568d263816f50bd5782cc7adec41249.tar.gz
Qt-f7e789710568d263816f50bd5782cc7adec41249.tar.bz2
Don't clear pre-edit text when a graphics items loses focus.
Don't forceably reset the input method state when a graphics item loses focus, reset the input context and let it handle sending the appropriate events itself. That way behavior is consistent with QWidget and the input context can opt to commit its current pre-edit text instead of discarding it. And don't change the focus until after the input context has been reset or the input method events won't be delivered. Change-Id: Ic545bccab6bf671709c1d06d499217baf614e6f9 Task-number: QTBUG-16997 Reviewed-by: axis
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 5e5077b..c395a54 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -806,28 +806,23 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
}
if (focusItem) {
- QFocusEvent event(QEvent::FocusOut, focusReason);
lastFocusItem = focusItem;
- focusItem = 0;
- sendEvent(lastFocusItem, &event);
#ifndef QT_NO_IM
if (lastFocusItem
&& (lastFocusItem->flags() & QGraphicsItem::ItemAcceptsInputMethod)) {
- // Reset any visible preedit text
- QInputMethodEvent imEvent;
- sendEvent(lastFocusItem, &imEvent);
-
// Close any external input method panel. This happens
// automatically by removing WA_InputMethodEnabled on
// the views, but if we are changing focus, we have to
// do it ourselves.
- if (item) {
- for (int i = 0; i < views.size(); ++i)
- if (views.at(i)->inputContext())
- views.at(i)->inputContext()->reset();
- }
+ for (int i = 0; i < views.size(); ++i)
+ if (views.at(i)->inputContext())
+ views.at(i)->inputContext()->reset();
}
+
+ focusItem = 0;
+ QFocusEvent event(QEvent::FocusOut, focusReason);
+ sendEvent(lastFocusItem, &event);
#endif //QT_NO_IM
}