summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qinputmethod.cpp
diff options
context:
space:
mode:
authorPekka Vuorela <pvuorela@iki.fi>2012-09-04 00:32:29 +0300
committerQt by Nokia <qt-info@nokia.com>2012-09-11 09:35:28 +0200
commite06999bd625c8e787d429a1296739a68e48a4e6f (patch)
tree76ab97cce1508a5922619e94078b01231165a082 /src/gui/kernel/qinputmethod.cpp
parentc3523bdde753daefd421e2ce228f0da0b70051ac (diff)
Remove deprecated inputItem and inputWindow from QInputMethod
Interfaces introduced and deprecated during Qt5 development. Change-Id: I804a02df8c4a03ed6558f4a86375f97d09513d5c Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel/qinputmethod.cpp')
-rw-r--r--src/gui/kernel/qinputmethod.cpp57
1 files changed, 3 insertions, 54 deletions
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()));
}
/*!
@@ -78,40 +76,6 @@ QInputMethod::~QInputMethod()
*/
/*!
- \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.
*/
QTransform QInputMethod::inputItemTransform() const
@@ -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;