diff options
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 5c4cc74990..81a9a80af8 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -3088,7 +3088,8 @@ void QWidgetPrivate::setEnabled_helper(bool enable) QWidget *focusWidget = effectiveFocusWidget(); QInputContext *qic = focusWidget->d_func()->inputContext(); if (enable) { - qic->setFocusWidget(focusWidget); + if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) + qic->setFocusWidget(focusWidget); } else { qic->reset(); qic->setFocusWidget(0); @@ -10357,17 +10358,22 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) #ifndef QT_NO_IM QWidget *focusWidget = d->effectiveFocusWidget(); QInputContext *ic = 0; - if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) { + if (on && !internalWinId() && hasFocus() + && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { ic = focusWidget->d_func()->inputContext(); - ic->reset(); - ic->setFocusWidget(0); + if (ic) { + ic->reset(); + ic->setFocusWidget(0); + } } if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) parentWidget()->d_func()->enforceNativeChildren(); if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) d->createWinId(); - if (ic && isEnabled()) + if (ic && isEnabled() && focusWidget->isEnabled() + && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { ic->setFocusWidget(focusWidget); + } #endif //QT_NO_IM break; } @@ -10404,7 +10410,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) if (!ic && (!on || hasFocus())) ic = focusWidget->d_func()->inputContext(); if (ic) { - if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled()) { + if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled() + && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { ic->setFocusWidget(focusWidget); } else if (!on && ic->focusWidget() == focusWidget) { ic->reset(); |