From 03da3d7f5c2fba60873bde5e69ecb047896a8bab Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 27 Apr 2012 23:25:57 +0200 Subject: Get rid of most warnings related to QInputMethod Change-Id: Id0b1235a5dc209c5c06e0a64613364c89e733005 Reviewed-by: Pekka Vuorela --- src/gui/kernel/qinputmethod.cpp | 12 +++--------- src/gui/kernel/qinputmethod_p.h | 11 +++++++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index 1144c798e2..0e0bc7237a 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -97,12 +97,7 @@ QObject *QInputMethod::inputItem() const void QInputMethod::setInputItem(QObject *inputItem) { Q_D(QInputMethod); - - if (d->inputItem.data() == inputItem) - return; - - d->inputItem = inputItem; - emit inputItemChanged(); + d->setInputItem(inputItem); } /*! @@ -299,7 +294,7 @@ void QInputMethod::update(Qt::InputMethodQueries queries) if (queries & Qt::ImEnabled) { QObject *focus = qApp->focusObject(); bool enabled = d->objectAcceptsInputMethod(focus); - setInputItem(enabled ? focus : 0); + d->setInputItem(enabled ? focus : 0); QPlatformInputContextPrivate::setInputMethodAccepted(enabled); } @@ -365,9 +360,8 @@ void QInputMethodPrivate::q_connectFocusObject() void QInputMethodPrivate::q_checkFocusObject(QObject *object) { - Q_Q(QInputMethod); bool enabled = objectAcceptsInputMethod(object); - q->setInputItem(enabled ? object : 0); + setInputItem(enabled ? object : 0); } bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object) diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 34a0430f10..1e55b00318 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -69,6 +69,17 @@ public: { return inputMethod->d_func(); } + inline void setInputItem(QObject *item) + { + Q_Q(QInputMethod); + + if (inputItem.data() == item) + return; + + inputItem = item; + emit q->inputItemChanged(); + } + void q_connectFocusObject(); void q_checkFocusObject(QObject *object); bool objectAcceptsInputMethod(QObject *object); -- cgit v1.2.3