diff options
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 475d4da..bf9f6f9 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -403,11 +403,24 @@ void QWidgetPrivate::scrollChildren(int dx, int dy) } } +QInputContext *QWidgetPrivate::assignedInputContext() const +{ +#ifndef QT_NO_IM + const QWidget *widget = q_func(); + while (widget) { + if (QInputContext *qic = widget->d_func()->ic) + return qic; + widget = widget->parentWidget(); + } +#endif + return 0; +} + QInputContext *QWidgetPrivate::inputContext() const { #ifndef QT_NO_IM - if (ic) - return ic; + if (QInputContext *qic = assignedInputContext()) + return qic; return qApp->inputContext(); #else return 0; @@ -10782,7 +10795,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) case Qt::WA_InputMethodEnabled: { #ifndef QT_NO_IM QWidget *focusWidget = d->effectiveFocusWidget(); - QInputContext *ic = focusWidget->d_func()->ic; + QInputContext *ic = focusWidget->d_func()->assignedInputContext(); if (!ic && (!on || hasFocus())) ic = focusWidget->d_func()->inputContext(); if (ic) { @@ -11269,7 +11282,7 @@ void QWidget::updateMicroFocus() #if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) Q_D(QWidget); // and optimization to update input context only it has already been created. - if (d->ic || qApp->d_func()->inputContext) { + if (d->assignedInputContext() || qApp->d_func()->inputContext) { QInputContext *ic = inputContext(); if (ic) ic->update(); |