summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2012-01-24 17:44:38 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-02 11:10:04 +0100
commit71726ccf676ef0921ef557c7162d2d87563066fb (patch)
tree5c6095908fcc9bb37fb3716cdc430aad5de5aab1 /src/gui/kernel
parentb2b3abe0ebc0ca147e1a29d06d1872bc09bf16cc (diff)
Renamed QInputPanel as QInputMethod
QInputMethod better describes what the class is about, input methods in general, be they panels or just composing input from key events. Compatability headers added for old name. Not bulletproof but should be enough to get transition done. Change-Id: Iefde6e7ccb1ec4a3b226cef3469089e751c60fc1 Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri4
-rw-r--r--src/gui/kernel/qguiapplication.cpp17
-rw-r--r--src/gui/kernel/qguiapplication.h5
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qinputmethod.cpp (renamed from src/gui/kernel/qinputpanel.cpp)112
-rw-r--r--src/gui/kernel/qinputmethod.h134
-rw-r--r--src/gui/kernel/qinputmethod_p.h83
-rw-r--r--src/gui/kernel/qinputpanel.h83
-rw-r--r--src/gui/kernel/qinputpanel_p.h33
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp28
10 files changed, 315 insertions, 186 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index bc0cb4e974..7b01ba14cd 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -38,6 +38,8 @@ HEADERS += \
kernel/qdnd_p.h \
kernel/qevent.h \
kernel/qevent_p.h \
+ kernel/qinputmethod.h \
+ kernel/qinputmethod_p.h \
kernel/qinputpanel.h \
kernel/qinputpanel_p.h \
kernel/qkeysequence.h \
@@ -84,7 +86,7 @@ SOURCES += \
kernel/qdrag.cpp \
kernel/qdnd.cpp \
kernel/qevent.cpp \
- kernel/qinputpanel.cpp \
+ kernel/qinputmethod.cpp \
kernel/qkeysequence.cpp \
kernel/qkeymapper.cpp \
kernel/qkeymapper_qpa.cpp \
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a97647f504..4096628d93 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -183,7 +183,7 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
: QCoreApplicationPrivate(argc, argv, flags),
styleHints(0),
- inputPanel(0)
+ inputMethod(0)
{
self = this;
application_type = QCoreApplication::GuiClient;
@@ -522,7 +522,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
cleanupThreadData();
delete styleHints;
- delete inputPanel;
+ delete inputMethod;
delete platform_integration;
platform_integration = 0;
@@ -1572,12 +1572,17 @@ QStyleHints *QGuiApplication::styleHints() const
\sa QInputPanel
*/
-QInputPanel *QGuiApplication::inputPanel() const
+QInputMethod *QGuiApplication::inputMethod() const
{
Q_D(const QGuiApplication);
- if (!d->inputPanel)
- const_cast<QGuiApplicationPrivate *>(d)->inputPanel = new QInputPanel();
- return d->inputPanel;
+ if (!d->inputMethod)
+ const_cast<QGuiApplicationPrivate *>(d)->inputMethod = new QInputMethod();
+ return d->inputMethod;
+}
+
+QInputPanel *QGuiApplication::inputPanel() const
+{
+ return inputMethod();
}
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 9bf6a69c45..75046d8767 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -44,6 +44,7 @@
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
+#include <QtGui/qinputpanel.h>
#include <QtCore/qlocale.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
@@ -58,7 +59,6 @@ class QPlatformNativeInterface;
class QPalette;
class QScreen;
class QStyleHints;
-class QInputPanel;
#if defined(qApp)
#undef qApp
@@ -121,7 +121,8 @@ public:
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
QStyleHints *styleHints() const;
- QInputPanel *inputPanel() const;
+ QT_DEPRECATED QInputPanel *inputPanel() const;
+ QInputMethod *inputMethod() const;
static QPlatformNativeInterface *platformNativeInterface();
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 2f1cfa509d..d9444ebe95 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -181,7 +181,7 @@ public:
static QFont *app_font;
QStyleHints *styleHints;
- QInputPanel *inputPanel;
+ QInputMethod *inputMethod;
static QList<QObject *> generic_plugin_list;
#ifndef QT_NO_SHORTCUT
diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputmethod.cpp
index 8b28c680bf..de00396e40 100644
--- a/src/gui/kernel/qinputpanel.cpp
+++ b/src/gui/kernel/qinputmethod.cpp
@@ -39,8 +39,8 @@
**
****************************************************************************/
-#include <qinputpanel.h>
-#include <private/qinputpanel_p.h>
+#include <qinputmethod.h>
+#include <private/qinputmethod_p.h>
#include <qguiapplication.h>
#include <qtimer.h>
@@ -49,8 +49,8 @@ QT_BEGIN_NAMESPACE
/*!
\internal
*/
-QInputPanel::QInputPanel()
- : QObject(*new QInputPanelPrivate)
+QInputMethod::QInputMethod()
+ : QObject(*new QInputMethodPrivate)
{
// might be instantiated before QGuiApplication is fully done, need to connect later
QTimer::singleShot(0, this, SLOT(q_connectFocusObject()));
@@ -59,24 +59,24 @@ QInputPanel::QInputPanel()
/*!
\internal
*/
-QInputPanel::~QInputPanel()
+QInputMethod::~QInputMethod()
{
}
/*!
- \class QInputPanel
- \brief The QInputPanel class provides access to the active text input method.
+ \class QInputMethod
+ \brief The QInputMethod class provides access to the active text input method.
- QInputPanel is used by the text editors for integrating to the platform text input
+ QInputMethod is used by the text editors for integrating to the platform text input
methods and more commonly by application views for querying various text input method-related
information like virtual keyboard visibility and keyboard dimensions.
- Qt Quick also provides access to QInputPanel in QML through \l{QmlGlobalQtObject}{Qt global object}
+ Qt Quick also provides access to QInputMethod in QML through \l{QmlGlobalQtObject}{Qt global object}
as \c Qt.application.inputPanel property.
*/
/*!
- \property QInputPanel::inputItem
+ \property QInputMethod::inputItem
\brief Focused item that accepts text input
\obsolete
@@ -87,15 +87,15 @@ QInputPanel::~QInputPanel()
\sa inputItemTransform, inputWindow, QInputMethodQueryEvent, QInputMethodEvent
*/
-QObject *QInputPanel::inputItem() const
+QObject *QInputMethod::inputItem() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
return d->inputItem.data();
}
-void QInputPanel::setInputItem(QObject *inputItem)
+void QInputMethod::setInputItem(QObject *inputItem)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
if (d->inputItem.data() == inputItem)
return;
@@ -109,7 +109,7 @@ void QInputPanel::setInputItem(QObject *inputItem)
\obsolete
*/
-QWindow *QInputPanel::inputWindow() const
+QWindow *QInputMethod::inputWindow() const
{
return qApp->activeWindow();
}
@@ -117,9 +117,9 @@ QWindow *QInputPanel::inputWindow() const
/*!
Returns the transformation from input item coordinates to the window coordinates.
*/
-QTransform QInputPanel::inputItemTransform() const
+QTransform QInputMethod::inputItemTransform() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
return d->inputItemTransform;
}
@@ -128,9 +128,9 @@ QTransform QInputPanel::inputItemTransform() const
Item transform needs to be updated by the focused window like QQuickCanvas whenever
item is moved inside the scene.
*/
-void QInputPanel::setInputItemTransform(const QTransform &transform)
+void QInputMethod::setInputItemTransform(const QTransform &transform)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
if (d->inputItemTransform == transform)
return;
@@ -139,15 +139,15 @@ void QInputPanel::setInputItemTransform(const QTransform &transform)
}
/*!
- \property QInputPanel::cursorRectangle
+ \property QInputMethod::cursorRectangle
\brief Input item's cursor rectangle in window coordinates.
Cursor rectangle is often used by various text editing controls
like text prediction popups for following the text being typed.
*/
-QRectF QInputPanel::cursorRectangle() const
+QRectF QInputMethod::cursorRectangle() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
if (!d->inputItem)
return QRectF();
@@ -162,12 +162,12 @@ QRectF QInputPanel::cursorRectangle() const
}
/*!
- \property QInputPanel::keyboardRectangle
+ \property QInputMethod::keyboardRectangle
\brief Virtual keyboard's geometry in window coordinates.
*/
-QRectF QInputPanel::keyboardRectangle() const
+QRectF QInputMethod::keyboardRectangle() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->keyboardRect();
@@ -183,9 +183,9 @@ QRectF QInputPanel::keyboardRectangle() const
function, keyboard should automatically open when
the text editor gains focus.
*/
-void QInputPanel::show()
+void QInputMethod::show()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->showInputPanel();
@@ -198,26 +198,26 @@ void QInputPanel::show()
keyboard should automatically close when the text editor loses
focus, for example when the parent view is closed.
*/
-void QInputPanel::hide()
+void QInputMethod::hide()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->hideInputPanel();
}
/*!
- \property QInputPanel::visible
+ \property QInputMethod::visible
\brief Virtual keyboard's visibility on the screen
- Input panel visibility remains false for devices
+ Input method visibility remains false for devices
with no virtual keyboards.
\sa show(), hide()
*/
-bool QInputPanel::visible() const
+bool QInputMethod::visible() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->isInputPanelVisible();
@@ -230,13 +230,13 @@ bool QInputPanel::visible() const
\sa show(), hide()
*/
-void QInputPanel::setVisible(bool visible)
+void QInputMethod::setVisible(bool visible)
{
visible ? show() : hide();
}
/*!
- \property QInputPanel::animating
+ \property QInputMethod::animating
\brief True when the virtual keyboard is being opened or closed.
Animating is false when keyboard is fully open or closed.
@@ -245,9 +245,9 @@ void QInputPanel::setVisible(bool visible)
false keyboard is being closed.
*/
-bool QInputPanel::isAnimating() const
+bool QInputMethod::isAnimating() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->isAnimating();
@@ -255,12 +255,12 @@ bool QInputPanel::isAnimating() const
}
/*!
- \property QInputPanel::locale
+ \property QInputMethod::locale
\brief Current input locale.
*/
-QLocale QInputPanel::locale() const
+QLocale QInputMethod::locale() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->locale();
@@ -268,12 +268,12 @@ QLocale QInputPanel::locale() const
}
/*!
- \property QInputPanel::inputDirection
+ \property QInputMethod::inputDirection
\brief Current input direction.
*/
-Qt::LayoutDirection QInputPanel::inputDirection() const
+Qt::LayoutDirection QInputMethod::inputDirection() const
{
- Q_D(const QInputPanel);
+ Q_D(const QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->inputDirection();
@@ -291,9 +291,9 @@ Qt::LayoutDirection QInputPanel::inputDirection() const
to change as well. The attributes that often change together with cursor position
have been grouped in Qt::ImQueryInput value for convenience.
*/
-void QInputPanel::update(Qt::InputMethodQueries queries)
+void QInputMethod::update(Qt::InputMethodQueries queries)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
if (queries & Qt::ImEnabled)
d->q_checkFocusObject(qApp->focusObject());
@@ -312,9 +312,9 @@ void QInputPanel::update(Qt::InputMethodQueries queries)
Input method resets automatically when the focused editor changes.
*/
-void QInputPanel::reset()
+void QInputMethod::reset()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->reset();
@@ -328,9 +328,9 @@ void QInputPanel::reset()
interrupts the text composing needs to flush the composing state by calling the
commit() function, for example when the cursor is moved elsewhere.
*/
-void QInputPanel::commit()
+void QInputMethod::commit()
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->commit();
@@ -341,26 +341,26 @@ void QInputPanel::commit()
the user. Input methods often use this information to offer more word
suggestions to the user.
*/
-void QInputPanel::invokeAction(Action a, int cursorPosition)
+void QInputMethod::invokeAction(Action a, int cursorPosition)
{
- Q_D(QInputPanel);
+ Q_D(QInputMethod);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
ic->invokeAction(a, cursorPosition);
}
// temporary handlers for updating focus item based on application focus
-void QInputPanelPrivate::q_connectFocusObject()
+void QInputMethodPrivate::q_connectFocusObject()
{
- Q_Q(QInputPanel);
+ Q_Q(QInputMethod);
QObject::connect(qApp, SIGNAL(focusObjectChanged(QObject*)),
q, SLOT(q_checkFocusObject(QObject*)));
q_checkFocusObject(qApp->focusObject());
}
-void QInputPanelPrivate::q_checkFocusObject(QObject *object)
+void QInputMethodPrivate::q_checkFocusObject(QObject *object)
{
- Q_Q(QInputPanel);
+ Q_Q(QInputMethod);
bool enabled = false;
if (object) {
@@ -373,4 +373,4 @@ void QInputPanelPrivate::q_checkFocusObject(QObject *object)
QT_END_NAMESPACE
-#include "moc_qinputpanel.cpp"
+#include "moc_qinputmethod.cpp"
diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h
new file mode 100644
index 0000000000..535ed1608d
--- /dev/null
+++ b/src/gui/kernel/qinputmethod.h
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QINPUTMETHOD_H
+#define QINPUTMETHOD_H
+
+#include <QtCore/qobject.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QInputMethodPrivate;
+class QWindow;
+class QRectF;
+class QTransform;
+
+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 visible NOTIFY visibleChanged)
+ Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
+ Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
+ Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
+
+ Q_ENUMS(Action)
+public:
+ QT_DEPRECATED QObject *inputItem() const;
+ QT_DEPRECATED void setInputItem(QObject *inputItemChanged);
+
+ // the window containing the editor
+ QT_DEPRECATED QWindow *inputWindow() const;
+
+ QTransform inputItemTransform() const;
+ void setInputItemTransform(const QTransform &transform);
+
+ // in window coordinates
+ QRectF cursorRectangle() const; // ### what if we have rotations for the item?
+
+ // keyboard geometry in window coords
+ QRectF keyboardRectangle() const;
+
+ enum Action {
+ Click,
+ ContextMenu
+ };
+
+ bool visible() const;
+ void setVisible(bool visible);
+
+ bool isAnimating() const;
+
+ QLocale locale() const;
+ Qt::LayoutDirection inputDirection() const;
+
+public Q_SLOTS:
+ void show();
+ void hide();
+
+ void update(Qt::InputMethodQueries queries);
+ void reset();
+ void commit();
+
+ void invokeAction(Action a, int cursorPosition);
+
+Q_SIGNALS:
+ void inputItemChanged();
+ void cursorRectangleChanged();
+ void keyboardRectangleChanged();
+ void visibleChanged();
+ void animatingChanged();
+ void localeChanged();
+ void inputDirectionChanged(Qt::LayoutDirection newDirection);
+
+private:
+ friend class QGuiApplication;
+ friend class QGuiApplicationPrivate;
+ 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
+
+QT_END_HEADER
+
+#endif
diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h
new file mode 100644
index 0000000000..862764d1bc
--- /dev/null
+++ b/src/gui/kernel/qinputmethod_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QINPUTMETHOD_P_H
+#define QINPUTMETHOD_P_H
+
+#include <qinputmethod.h>
+#include <private/qobject_p.h>
+#include <QtCore/QWeakPointer>
+#include <QTransform>
+#include <qplatforminputcontext_qpa.h>
+#include <private/qguiapplication_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+class QInputMethodPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QInputMethod)
+
+public:
+ inline QInputMethodPrivate() : testContext(0)
+ {}
+ QPlatformInputContext *platformInputContext() const
+ {
+ return testContext ? testContext : QGuiApplicationPrivate::platformIntegration()->inputContext();
+ }
+ static inline QInputMethodPrivate *get(QInputMethod *inputMethod)
+ {
+ return inputMethod->d_func();
+ }
+ void q_connectFocusObject();
+ void q_checkFocusObject(QObject *object);
+
+ QTransform inputItemTransform;
+ QWeakPointer<QObject> inputItem;
+ QPlatformInputContext *testContext;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif
diff --git a/src/gui/kernel/qinputpanel.h b/src/gui/kernel/qinputpanel.h
index 7b16709e42..95be71d7b5 100644
--- a/src/gui/kernel/qinputpanel.h
+++ b/src/gui/kernel/qinputpanel.h
@@ -42,89 +42,16 @@
#ifndef QINPUTPANEL_H
#define QINPUTPANEL_H
-#include <QtCore/qobject.h>
+#include <QtGui/qinputmethod.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
-class QInputPanelPrivate;
-class QWindow;
-class QRectF;
-class QTransform;
-
-class Q_GUI_EXPORT QInputPanel : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QInputPanel)
- 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 visible NOTIFY visibleChanged)
- Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
- Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
- Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
-
- Q_ENUMS(Action)
-public:
- QT_DEPRECATED QObject *inputItem() const;
- QT_DEPRECATED void setInputItem(QObject *inputItemChanged);
-
- // the window containing the editor
- QT_DEPRECATED QWindow *inputWindow() const;
-
- QTransform inputItemTransform() const;
- void setInputItemTransform(const QTransform &transform);
-
- // in window coordinates
- QRectF cursorRectangle() const; // ### what if we have rotations for the item?
-
- // keyboard geometry in window coords
- QRectF keyboardRectangle() const;
-
- enum Action {
- Click,
- ContextMenu
- };
-
- bool visible() const;
- void setVisible(bool visible);
-
- bool isAnimating() const;
-
- QLocale locale() const;
- Qt::LayoutDirection inputDirection() const;
-
-public Q_SLOTS:
- void show();
- void hide();
-
- void update(Qt::InputMethodQueries queries);
- void reset();
- void commit();
-
- void invokeAction(Action a, int cursorPosition);
-
-Q_SIGNALS:
- void inputItemChanged();
- void cursorRectangleChanged();
- void keyboardRectangleChanged();
- void visibleChanged();
- void animatingChanged();
- void localeChanged();
- void inputDirectionChanged(Qt::LayoutDirection newDirection);
-
-private:
- friend class QGuiApplication;
- friend class QGuiApplicationPrivate;
- friend class QPlatformInputContext;
- QInputPanel();
- ~QInputPanel();
-
- Q_PRIVATE_SLOT(d_func(), void q_connectFocusObject());
- Q_PRIVATE_SLOT(d_func(), void q_checkFocusObject(QObject* object));
-};
+#if 0
+#pragma qt_class(QInputPanel)
+#endif
+#define QInputPanel QInputMethod
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputpanel_p.h b/src/gui/kernel/qinputpanel_p.h
index 88916f80a4..a4f24505c6 100644
--- a/src/gui/kernel/qinputpanel_p.h
+++ b/src/gui/kernel/qinputpanel_p.h
@@ -42,39 +42,16 @@
#ifndef QINPUTPANEL_P_H
#define QINPUTPANEL_P_H
-#include <qinputpanel.h>
-#include <private/qobject_p.h>
-#include <QtCore/QWeakPointer>
-#include <QTransform>
-#include <qplatforminputcontext_qpa.h>
-#include <private/qguiapplication_p.h>
+#include <private/qinputmethod_p.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QInputPanelPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QInputPanel)
-
-public:
- inline QInputPanelPrivate() : testContext(0)
- {}
- QPlatformInputContext *platformInputContext() const
- {
- return testContext ? testContext : QGuiApplicationPrivate::platformIntegration()->inputContext();
- }
- static inline QInputPanelPrivate *get(QInputPanel *inputPanel)
- {
- return inputPanel->d_func();
- }
- void q_connectFocusObject();
- void q_checkFocusObject(QObject *object);
-
- QTransform inputItemTransform;
- QWeakPointer<QObject> inputItem;
- QPlatformInputContext *testContext;
-};
+#if 0
+#pragma qt_class(QInputPanelPrivate)
+#endif
+#define QInputPanelPrivate QInputMethodPrivate
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index f36a4a1af5..ee18f3ebd1 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
QPlatformInputContext provides an interface the actual input methods
can derive from by reimplementing methods.
- \sa QInputPanel
+ \sa QInputMethod
*/
/*!
@@ -94,7 +94,7 @@ bool QPlatformInputContext::isValid() const
}
/*!
- Method to be called when input method needs to be reset. Called by QInputPanel::reset().
+ Method to be called when input method needs to be reset. Called by QInputMethod::reset().
No further QInputMethodEvents should be sent as response.
*/
void QPlatformInputContext::reset()
@@ -106,7 +106,7 @@ void QPlatformInputContext::commit()
}
/*!
- Notification on editor updates. Called by QInputPanel::update().
+ Notification on editor updates. Called by QInputMethod::update().
*/
void QPlatformInputContext::update(Qt::InputMethodQueries)
{
@@ -117,12 +117,12 @@ void QPlatformInputContext::update(Qt::InputMethodQueries)
the user. Input methods often use this information to offer more word
suggestions to the user.
*/
-void QPlatformInputContext::invokeAction(QInputPanel::Action action, int cursorPosition)
+void QPlatformInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
{
Q_UNUSED(cursorPosition)
// Default behavior for simple ephemeral input contexts. Some
// complex input contexts should not be reset here.
- if (action == QInputPanel::Click)
+ if (action == QInputMethod::Click)
reset();
}
@@ -148,17 +148,17 @@ QRectF QPlatformInputContext::keyboardRect() const
}
/*!
- Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputPanel.
+ Active QPlatformInputContext is responsible for providing keyboardRectangle property to QInputMethod.
In addition of providing the value in keyboardRect function, it also needs to call this emit
function whenever the property changes.
*/
void QPlatformInputContext::emitKeyboardRectChanged()
{
- emit qApp->inputPanel()->keyboardRectangleChanged();
+ emit qApp->inputMethod()->keyboardRectangleChanged();
}
/*!
- This function can be reimplemented to return true whenever input panel is animating
+ This function can be reimplemented to return true whenever input method is animating
shown or hidden. Default implementation returns false.
*/
bool QPlatformInputContext::isAnimating() const
@@ -167,13 +167,13 @@ bool QPlatformInputContext::isAnimating() const
}
/*!
- Active QPlatformInputContext is responsible for providing animating property to QInputPanel.
+ Active QPlatformInputContext is responsible for providing animating property to QInputMethod.
In addition of providing the value in isAnimation function, it also needs to call this emit
function whenever the property changes.
*/
void QPlatformInputContext::emitAnimatingChanged()
{
- emit qApp->inputPanel()->animatingChanged();
+ emit qApp->inputMethod()->animatingChanged();
}
/*!
@@ -199,13 +199,13 @@ bool QPlatformInputContext::isInputPanelVisible() const
}
/*!
- Active QPlatformInputContext is responsible for providing visible property to QInputPanel.
+ Active QPlatformInputContext is responsible for providing visible property to QInputMethod.
In addition of providing the value in isInputPanelVisible function, it also needs to call this emit
function whenever the property changes.
*/
void QPlatformInputContext::emitInputPanelVisibleChanged()
{
- emit qApp->inputPanel()->visibleChanged();
+ emit qApp->inputMethod()->visibleChanged();
}
QLocale QPlatformInputContext::locale() const
@@ -215,7 +215,7 @@ QLocale QPlatformInputContext::locale() const
void QPlatformInputContext::emitLocaleChanged()
{
- emit qApp->inputPanel()->localeChanged();
+ emit qApp->inputMethod()->localeChanged();
}
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
@@ -225,7 +225,7 @@ Qt::LayoutDirection QPlatformInputContext::inputDirection() const
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
{
- emit qApp->inputPanel()->inputDirectionChanged(newDirection);
+ emit qApp->inputMethod()->inputDirectionChanged(newDirection);
}