summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qapplication.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-04-07 06:16:59 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-04-07 06:16:59 (GMT)
commitcbec6d9481bf8f55834eafac4eca53f85206b240 (patch)
tree9875b3dd5a87c0274ee0d57f541f836598936f2b /src/gui/kernel/qapplication.cpp
parentbe8b6047ccd43df1127beb4c602c58408ff9b612 (diff)
parent939623b2bc8e441618ee1a1886cc656880bee62b (diff)
downloadQt-cbec6d9481bf8f55834eafac4eca53f85206b240.zip
Qt-cbec6d9481bf8f55834eafac4eca53f85206b240.tar.gz
Qt-cbec6d9481bf8f55834eafac4eca53f85206b240.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into windows-7-multitouch
Diffstat (limited to 'src/gui/kernel/qapplication.cpp')
-rw-r--r--src/gui/kernel/qapplication.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 77482c9..52d6a70 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2056,9 +2056,13 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
QWidget *prev = focus_widget;
focus_widget = focus;
- if (prev && reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason &&
- prev->testAttribute(Qt::WA_InputMethodEnabled)) {
- QInputContext *qic = prev->inputContext();
+ if (prev && ((reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason
+ && prev->testAttribute(Qt::WA_InputMethodEnabled))
+ // Do reset the input context, in case the new focus widget won't accept keyboard input
+ // or it is not created fully yet.
+ || (focus_widget && (!focus_widget->testAttribute(Qt::WA_InputMethodEnabled)
+ || !focus_widget->testAttribute(Qt::WA_WState_Created))))) {
+ QInputContext *qic = prev->inputContext();
if(qic) {
qic->reset();
qic->setFocusWidget(0);
@@ -2087,8 +2091,9 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
if(focus && QApplicationPrivate::focus_widget == focus) {
if (focus->testAttribute(Qt::WA_InputMethodEnabled)) {
QInputContext *qic = focus->inputContext();
- if (qic && focus_widget->testAttribute(Qt::WA_WState_Created))
- qic->setFocusWidget( focus_widget );
+ if (qic && focus->testAttribute(Qt::WA_WState_Created)
+ && focus->isEnabled())
+ qic->setFocusWidget(focus);
}
QFocusEvent in(QEvent::FocusIn, reason);
QPointer<QWidget> that = focus;