From e06999bd625c8e787d429a1296739a68e48a4e6f Mon Sep 17 00:00:00 2001 From: Pekka Vuorela Date: Tue, 4 Sep 2012 00:32:29 +0300 Subject: Remove deprecated inputItem and inputWindow from QInputMethod Interfaces introduced and deprecated during Qt5 development. Change-Id: I804a02df8c4a03ed6558f4a86375f97d09513d5c Reviewed-by: Qt Doc Bot Reviewed-by: Lars Knoll --- src/gui/kernel/qinputmethod.cpp | 57 +++-------------------------------------- src/gui/kernel/qinputmethod.h | 14 ---------- src/gui/kernel/qinputmethod_p.h | 11 -------- 3 files changed, 3 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index 5cb36f21c7..da7d866885 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -53,8 +53,6 @@ QT_BEGIN_NAMESPACE QInputMethod::QInputMethod() : QObject(*new QInputMethodPrivate) { - // might be instantiated before QGuiApplication is fully done, need to connect later - QTimer::singleShot(0, this, SLOT(_q_connectFocusObject())); } /*! @@ -77,40 +75,6 @@ QInputMethod::~QInputMethod() as \c Qt.inputMethod property. */ -/*! - \property QInputMethod::inputItem - \brief Focused item that accepts text input - \obsolete - - Input item is set and unset by the focused window. In QML Scene Graph this is done by - QQuickCanvas and the input item is either TextInput or TextEdit element. Any QObject can - behave as an input item as long as it responds to QInputMethodQueryEvent and QInputMethodEvent - events sent by the input methods. - - \sa inputItemTransform, inputWindow, QInputMethodQueryEvent, QInputMethodEvent -*/ -QObject *QInputMethod::inputItem() const -{ - Q_D(const QInputMethod); - return d->inputItem.data(); -} - -void QInputMethod::setInputItem(QObject *inputItem) -{ - Q_D(QInputMethod); - d->setInputItem(inputItem); -} - -/*! - Returns the currently focused window containing the input item. - - \obsolete -*/ -QWindow *QInputMethod::inputWindow() const -{ - return qApp->focusWindow(); -} - /*! Returns the transformation from input item coordinates to the window coordinates. */ @@ -146,11 +110,12 @@ QRectF QInputMethod::cursorRectangle() const { Q_D(const QInputMethod); - if (!d->inputItem) + QObject *focusObject = qGuiApp->focusObject(); + if (!focusObject) return QRectF(); QInputMethodQueryEvent query(Qt::ImCursorRectangle); - QGuiApplication::sendEvent(d->inputItem.data(), &query); + QGuiApplication::sendEvent(focusObject, &query); QRectF r = query.value(Qt::ImCursorRectangle).toRectF(); if (!r.isValid()) return QRectF(); @@ -303,7 +268,6 @@ void QInputMethod::update(Qt::InputMethodQueries queries) if (queries & Qt::ImEnabled) { QObject *focus = qApp->focusObject(); bool enabled = d->objectAcceptsInputMethod(focus); - d->setInputItem(enabled ? focus : 0); QPlatformInputContextPrivate::setInputMethodAccepted(enabled); } @@ -369,21 +333,6 @@ void QInputMethod::invokeAction(Action a, int cursorPosition) ic->invokeAction(a, cursorPosition); } -// temporary handlers for updating focus item based on application focus -void QInputMethodPrivate::_q_connectFocusObject() -{ - Q_Q(QInputMethod); - QObject::connect(qApp, SIGNAL(focusObjectChanged(QObject*)), - q, SLOT(_q_checkFocusObject(QObject*))); - _q_checkFocusObject(qApp->focusObject()); -} - -void QInputMethodPrivate::_q_checkFocusObject(QObject *object) -{ - bool enabled = objectAcceptsInputMethod(object); - setInputItem(enabled ? object : 0); -} - bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object) { bool enabled = false; diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h index 4b21e4ac15..dc3e43a45f 100644 --- a/src/gui/kernel/qinputmethod.h +++ b/src/gui/kernel/qinputmethod.h @@ -59,7 +59,6 @@ class Q_GUI_EXPORT QInputMethod : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QInputMethod) - Q_PROPERTY(QObject *inputItem READ inputItem WRITE setInputItem NOTIFY inputItemChanged) Q_PROPERTY(QRectF cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged) Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged) Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged) @@ -69,14 +68,6 @@ class Q_GUI_EXPORT QInputMethod : public QObject Q_ENUMS(Action) public: -#ifdef QT_DEPRECATED - QT_DEPRECATED QObject *inputItem() const; - QT_DEPRECATED void setInputItem(QObject *inputItemChanged); - - // the window containing the editor - QT_DEPRECATED QWindow *inputWindow() const; -#endif - QTransform inputItemTransform() const; void setInputItemTransform(const QTransform &transform); @@ -114,7 +105,6 @@ public Q_SLOTS: void invokeAction(Action a, int cursorPosition); Q_SIGNALS: - void inputItemChanged(); void cursorRectangleChanged(); void keyboardRectangleChanged(); void visibleChanged(); @@ -128,10 +118,6 @@ private: friend class QPlatformInputContext; QInputMethod(); ~QInputMethod(); - - Q_PRIVATE_SLOT(d_func(), void _q_connectFocusObject()) - Q_PRIVATE_SLOT(d_func(), void _q_checkFocusObject(QObject* object)) - }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 69d3f2d065..2df7e70332 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -69,23 +69,12 @@ 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); QTransform inputItemTransform; - QPointer inputItem; QPlatformInputContext *testContext; }; -- cgit v1.2.3