diff options
author | Pekka Vuorela <pekka.ta.vuorela@nokia.com> | 2012-01-23 13:09:14 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-27 13:28:03 +0100 |
commit | 1166ad8603fe4fbd1b008aaa7c043ee1078780a5 (patch) | |
tree | 1dadf8ef4160a2abaf7c5f020042d4cfc5905af9 /src/widgets/kernel/qwidget.cpp | |
parent | dd565d2d4c7e9b766bc9f575d803ebaad71b33b7 (diff) |
QWidgets to use QGuiApplication focus object change notifications
Moving away from deprecated QInputPanel inputItem.
Small behavioral changes:
- On focus proxy widgets, disabling WA_InputMethodEnabled on
proxy will no longer disable input method for proxy target.
- setEnabled(false) on proxy widget will no longer disable
input method for target as a special case.
Change-Id: Ifb5b7144d29bd3aefdde7cf4a0bd396db06e67e2
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 2dcda5eb4a..9a12efd6a8 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -355,7 +355,7 @@ void QWidgetPrivate::scrollChildren(int dx, int dy) void QWidgetPrivate::updateWidgetTransform() { Q_Q(QWidget); - if (q == qApp->inputPanel()->inputItem()) { + if (q == qGuiApp->focusObject()) { QTransform t; QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0)); t.translate(p.x(), p.y()); @@ -3125,10 +3125,10 @@ void QWidgetPrivate::setEnabled_helper(bool enable) if (enable) { if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) - qApp->inputPanel()->setInputItem(focusWidget); + qApp->inputPanel()->update(Qt::ImEnabled); } else { qApp->inputPanel()->reset(); - qApp->inputPanel()->setInputItem(0); + qApp->inputPanel()->update(Qt::ImEnabled); } } #endif //QT_NO_IM @@ -10137,7 +10137,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) if (on && !internalWinId() && hasFocus() && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { qApp->inputPanel()->reset(); - qApp->inputPanel()->setInputItem(0); + qApp->inputPanel()->update(Qt::ImEnabled); } if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget() #ifdef Q_WS_MAC @@ -10151,7 +10151,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->createWinId(); if (isEnabled() && focusWidget->isEnabled() && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { - qApp->inputPanel()->setInputItem(focusWidget); + qApp->inputPanel()->update(Qt::ImEnabled); } #endif //QT_NO_IM break; @@ -10184,13 +10184,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_InputMethodEnabled: { #ifndef QT_NO_IM - QWidget *focusWidget = d->effectiveFocusWidget(); - if (on && hasFocus() && isEnabled() - && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { - qApp->inputPanel()->setInputItem(focusWidget); - } else if (!on && qApp->inputPanel()->inputItem() == focusWidget) { - qApp->inputPanel()->reset(); - qApp->inputPanel()->setInputItem(0); + if (qApp->focusObject() == this) { + if (!on) + qApp->inputPanel()->reset(); + qApp->inputPanel()->update(Qt::ImEnabled); } #endif //QT_NO_IM break; |