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 \
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 \
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
: QCoreApplicationPrivate(argc, argv, flags),
styleHints(0),
- inputPanel(0)
+ inputMethod(0)
{
self = this;
application_type = QCoreApplication::GuiClient;
cleanupThreadData();
delete styleHints;
- delete inputPanel;
+ delete inputMethod;
delete platform_integration;
platform_integration = 0;
\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();
}
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindowdefs.h>
+#include <QtGui/qinputpanel.h>
#include <QtCore/qlocale.h>
#include <QtCore/qpoint.h>
#include <QtCore/qsize.h>
class QPalette;
class QScreen;
class QStyleHints;
-class QInputPanel;
#if defined(qApp)
#undef qApp
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();
static QFont *app_font;
QStyleHints *styleHints;
- QInputPanel *inputPanel;
+ QInputMethod *inputMethod;
static QList<QObject *> generic_plugin_list;
#ifndef QT_NO_SHORTCUT
**
****************************************************************************/
-#include <qinputpanel.h>
-#include <private/qinputpanel_p.h>
+#include <qinputmethod.h>
+#include <private/qinputmethod_p.h>
#include <qguiapplication.h>
#include <qtimer.h>
/*!
\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()));
/*!
\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
\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;
\obsolete
*/
-QWindow *QInputPanel::inputWindow() const
+QWindow *QInputMethod::inputWindow() const
{
return qApp->activeWindow();
}
/*!
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;
}
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;
}
/*!
- \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();
}
/*!
- \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();
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();
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();
\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.
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();
}
/*!
- \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();
}
/*!
- \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();
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());
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();
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();
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) {
QT_END_NAMESPACE
-#include "moc_qinputpanel.cpp"
+#include "moc_qinputmethod.cpp"
--- /dev/null
+/****************************************************************************
+**
+** 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
--- /dev/null
+/****************************************************************************
+**
+** 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
#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
#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
QPlatformInputContext provides an interface the actual input methods
can derive from by reimplementing methods.
- \sa QInputPanel
+ \sa QInputMethod
*/
/*!
}
/*!
- 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()
}
/*!
- Notification on editor updates. Called by QInputPanel::update().
+ Notification on editor updates. Called by QInputMethod::update().
*/
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();
}
}
/*!
- 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
}
/*!
- 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();
}
/*!
}
/*!
- 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
void QPlatformInputContext::emitLocaleChanged()
{
- emit qApp->inputPanel()->localeChanged();
+ emit qApp->inputMethod()->localeChanged();
}
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
{
- emit qApp->inputPanel()->inputDirectionChanged(newDirection);
+ emit qApp->inputMethod()->inputDirectionChanged(newDirection);
}
#include <private/qunicodetables_p.h>
#include "qtextdocument_p.h"
#include <qguiapplication.h>
-#include <qinputpanel.h>
+#include <qinputmethod.h>
#include <stdlib.h>
itemize();
// this places the cursor in the right position depending on the keyboard layout
if (layoutData->string.isEmpty())
- return qApp ? qApp->inputPanel()->inputDirection() == Qt::RightToLeft : false;
+ return qApp ? qApp->inputMethod()->inputDirection() == Qt::RightToLeft : false;
return layoutData->string.isRightToLeft();
}
connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
}
- QInputPanel *p = qApp->inputPanel();
+ QInputMethod *p = qApp->inputMethod();
connect(p, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
connect(p, SIGNAL(cursorRectangleChanged()), this, SLOT(cursorRectChanged()));
}
return d->valid;
}
-void QIBusPlatformInputContext::invokeAction(QInputPanel::Action a, int x)
+void QIBusPlatformInputContext::invokeAction(QInputMethod::Action a, int x)
{
if (!d->valid)
return;
- if (a == QInputPanel::Click)
+ if (a == QInputMethod::Click)
commit();
}
if (!d->valid)
return;
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input) {
d->predit = QString();
return;
if (!d->valid)
return;
- QRect r = qApp->inputPanel()->cursorRectangle().toRect();
+ QRect r = qApp->inputMethod()->cursorRectangle().toRect();
if(!r.isValid())
return;
- QWindow *inputWindow = qApp->inputPanel()->inputWindow();
+ QWindow *inputWindow = qApp->inputMethod()->inputWindow();
if (!inputWindow)
return;
r.moveTopLeft(inputWindow->mapToGlobal(r.topLeft()));
if (!d->valid)
return;
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (debug)
qDebug() << "setFocusObject" << input;
if (input)
void QIBusPlatformInputContext::commitText(const QDBusVariant &text)
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint cursorPos, bool visible)
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
{
if (debug)
qDebug() << "QMaliitPlatformInputContext::QMaliitPlatformInputContext()";
- QInputPanel *p = qApp->inputPanel();
- connect(p, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
+ QInputMethod *im = qApp->inputMethod();
+ connect(im, SIGNAL(inputItemChanged()), this, SLOT(inputItemChanged()));
}
QMaliitPlatformInputContext::~QMaliitPlatformInputContext(void)
return d->valid;
}
-void QMaliitPlatformInputContext::invokeAction(QInputPanel::Action action, int x)
+void QMaliitPlatformInputContext::invokeAction(QInputMethod::Action action, int x)
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
- if (action == QInputPanel::Click) {
+ if (action == QInputMethod::Click) {
if (x < 0 || x >= d->preedit.length()) {
reset();
return;
void QMaliitPlatformInputContext::reset()
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
const bool hadPreedit = !d->preedit.isEmpty();
if (hadPreedit && input) {
void QMaliitPlatformInputContext::update(Qt::InputMethodQueries queries)
{
- QInputPanel *panel = qApp->inputPanel();
- QObject *input = panel->inputItem();
+ QInputMethod *method = qApp->inputMethod();
+ QObject *input = method->inputItem();
if (!input)
return;
d->imState["anchorPosition"] = query.value(Qt::ImAnchorPosition);
if (queries & Qt::ImCursorRectangle) {
QRect rect = query.value(Qt::ImCursorRectangle).toRect();
- rect = panel->inputItemTransform().mapRect(rect);
- QWindow *window = panel->inputWindow();
+ rect = method->inputItemTransform().mapRect(rect);
+ QWindow *window = method->inputWindow();
if (window)
d->imState["cursorRectangle"] = QRect(window->mapToGlobal(rect.topLeft()), rect.size());
}
void QMaliitPlatformInputContext::commitString(const QString &string, int replacementStart, int replacementLength, int cursorPos)
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
void QMaliitPlatformInputContext::updatePreedit(const QDBusMessage &message)
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
bool QMaliitPlatformInputContext::preeditRectangle(int &x, int &y, int &width, int &height)
{
// ###
- QRect r = qApp->inputPanel()->cursorRectangle().toRect();
+ QRect r = qApp->inputMethod()->cursorRectangle().toRect();
if (!r.isValid())
return false;
x = r.x();
{
selection.clear();
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return false;
void QMaliitPlatformInputContext::setSelection(int start, int length)
{
- QObject *input = qApp->inputPanel()->inputItem();
+ QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
if (!d->valid)
return;
- QInputPanel *panel = qApp->inputPanel();
- QObject *input = panel->inputItem();
- QWindow *window = panel->inputWindow();
+ QInputMethod *method = qApp->inputMethod();
+ QObject *input = method->inputItem();
+ QWindow *window = method->inputWindow();
if (window != d->window.data()) {
if (d->window)
disconnect(d->window.data(), SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)),
if (debug)
qDebug() << "showInputPanel";
- QInputPanel *panel = qApp->inputPanel();
- if (!panel->inputItem() || !panel->inputWindow())
+ QInputMethod *method = qApp->inputMethod();
+ if (!method->inputItem() || !method->inputWindow())
d->visibility = InputPanelShowRequested;
else {
d->server->showInputMethod();
m_WM_MSIME_MOUSE(RegisterWindowMessage(L"MSIMEMouseOperation")),
m_endCompositionRecursionGuard(false)
{
- connect(qApp->inputPanel(), SIGNAL(cursorRectangleChanged()),
+ connect(qApp->inputMethod(), SIGNAL(cursorRectangleChanged()),
this, SLOT(cursorRectChanged()));
}
QPlatformInputContext::reset();
if (!m_compositionContext.hwnd)
return;
- QObject *fo = qApp->inputPanel()->inputItem();
+ QObject *fo = qApp->inputMethod()->inputItem();
if (QWindowsContext::verboseInputMethods)
qDebug() << __FUNCTION__<< fo;
if (!fo)
{
if (!m_compositionContext.hwnd)
return;
- const QInputPanel *inputPanel = qApp->inputPanel();
- QRect cursorRectangle = inputPanel->cursorRectangle().toRect();
+ const QInputMethod *inputMethod = qApp->inputMethod();
+ QRect cursorRectangle = inputMethod->cursorRectangle().toRect();
if (!cursorRectangle.isValid())
return;
ImmReleaseContext(m_compositionContext.hwnd, himc);
}
-void QWindowsInputContext::invokeAction(QInputPanel::Action action, int cursorPosition)
+void QWindowsInputContext::invokeAction(QInputMethod::Action action, int cursorPosition)
{
- if (action != QInputPanel::Click || !m_compositionContext.hwnd) {
+ if (action != QInputMethod::Click || !m_compositionContext.hwnd) {
QPlatformInputContext::invokeAction(action, cursorPosition);
return;
}
bool QWindowsInputContext::startComposition(HWND hwnd)
{
- const QObject *fo = qApp->inputPanel()->inputItem();
+ const QObject *fo = qApp->inputMethod()->inputItem();
if (!fo)
return false;
// This should always match the object.
- QWindow *window = qApp->inputPanel()->inputWindow();
+ QWindow *window = qApp->inputMethod()->inputWindow();
if (!window)
return false;
if (QWindowsContext::verboseInputMethods)
bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn)
{
- QObject *fo = qApp->inputPanel()->inputItem();
+ QObject *fo = qApp->inputMethod()->inputItem();
const int lParam = int(lParamIn);
if (QWindowsContext::verboseInputMethods)
qDebug() << '>' << __FUNCTION__ << fo << debugComposition(lParam)
// against that.
if (m_endCompositionRecursionGuard || m_compositionContext.hwnd != hwnd)
return false;
- QObject *fo = qApp->inputPanel()->inputItem();
+ QObject *fo = qApp->inputMethod()->inputItem();
if (!fo)
return false;
int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
{
- QObject *fo = qApp->inputPanel()->inputItem();
+ QObject *fo = qApp->inputMethod()->inputItem();
if (!fo)
return false;
#include <QtGui/qpixmapcache.h>
#include <QtWidgets/qstyleoption.h>
#include <QtGui/qevent.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h"
QWidget *fw = QApplication::focusWidget();
if (!fw)
return;
- qApp->inputPanel()->update(Qt::ImHints);
+ qApp->inputMethod()->update(Qt::ImHints);
}
/*!
for (int i = 0 ; i < scene()->views().count() ; ++i) {
if (scene()->views().at(i) == fw) {
if (qApp)
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
#ifndef QT_NO_ACCESSIBILITY
// ##### is this correct
// Reset the focus widget's input context, regardless
// of how this item gained or lost focus.
if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
} else {
- qApp->inputPanel()->update(Qt::ImQueryInput);
+ qApp->inputMethod()->update(Qt::ImQueryInput);
}
break;
case QEvent::ShortcutOverride:
#include <QtWidgets/qstyleoption.h>
#include <QtWidgets/qtooltip.h>
#include <QtGui/qtransform.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_ACCESSIBILITY
# include <QtGui/qaccessible.h>
// the views, but if we are changing focus, we have to
// do it ourselves.
if (qApp)
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
focusItem = 0;
#include "qmessagebox.h"
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtGui/qstylehints.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include "qinputcontext.h"
#include "private/qkeymapper_p.h"
// or it is not created fully yet.
|| (focus_widget && (!focus_widget->testAttribute(Qt::WA_InputMethodEnabled)
|| !focus_widget->testAttribute(Qt::WA_WState_Created))))) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
#endif //QT_NO_IM
break;
}
case QEvent::RequestSoftwareInputPanel:
- inputPanel()->show();
+ inputMethod()->show();
break;
case QEvent::CloseSoftwareInputPanel:
- inputPanel()->hide();
+ inputMethod()->hide();
break;
#ifndef QT_NO_GESTURES
\since 4.2
\obsolete
- Returns the current keyboard input locale. Replaced with QInputPanel::locale()
+ Returns the current keyboard input locale. Replaced with QInputMethod::locale()
*/
QLocale QApplication::keyboardInputLocale()
{
- return qApp ? qApp->inputPanel()->locale() : QLocale::c();
+ return qApp ? qApp->inputMethod()->locale() : QLocale::c();
}
/*!
\since 4.2
\obsolete
- Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
+ Returns the current keyboard input direction. Replaced with QInputMethod::inputDirection()
*/
Qt::LayoutDirection QApplication::keyboardInputDirection()
{
- return qApp ? qApp->inputPanel()->inputDirection() : Qt::LeftToRight;
+ return qApp ? qApp->inputMethod()->inputDirection() : Qt::LeftToRight;
}
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
#include "qmenu.h"
#include "qtextformat.h"
#include "qpalette.h"
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <QtGui/qevent.h>
#include <stdlib.h>
void QInputContext::sendEvent(const QInputMethodEvent &event)
{
- QObject *focus = qApp->inputPanel()->inputItem();
+ QObject *focus = qApp->inputMethod()->inputItem();
if (!focus)
return;
void QInputContext::mouseHandler(int x, QMouseEvent *event)
{
if (event->type() == QEvent::MouseButtonRelease)
- qApp->inputPanel()->invokeAction(QInputPanel::Click, x);
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, x);
}
*/
void QInputContext::update()
{
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
}
/*!
void QInputContext::widgetDestroyed(QWidget *widget)
{
Q_UNUSED(widget)
- // nothing to be done here, as we use a weak pointer in the input panel
+ // nothing to be done here, as we use a weak pointer in the input method
}
/*!
*/
void QInputContext::reset()
{
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
#include "qinputcontext.h"
#include "qfileinfo.h"
#include "private/qsoftkeymanager_p.h"
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <private/qgraphicseffect_p.h>
#include <qbackingstore.h>
QTransform t;
QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
t.translate(p.x(), p.y());
- qApp->inputPanel()->setInputItemTransform(t);
+ qApp->inputMethod()->setInputItemTransform(t);
}
}
if (enable) {
if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
- qApp->inputPanel()->update(Qt::ImEnabled);
+ qApp->inputMethod()->update(Qt::ImEnabled);
} else {
- qApp->inputPanel()->reset();
- qApp->inputPanel()->update(Qt::ImEnabled);
+ qApp->inputMethod()->reset();
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
}
#endif //QT_NO_IM
#ifndef QT_NO_IM
Q_D(QWidget);
d->imHints = hints;
- qApp->inputPanel()->update(Qt::ImHints);
+ qApp->inputMethod()->update(Qt::ImHints);
#endif //QT_NO_IM
}
QWidget *focusWidget = d->effectiveFocusWidget();
if (on && !internalWinId() && hasFocus()
&& focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
- qApp->inputPanel()->reset();
- qApp->inputPanel()->update(Qt::ImEnabled);
+ qApp->inputMethod()->reset();
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()
#ifdef Q_WS_MAC
d->createWinId();
if (isEnabled() && focusWidget->isEnabled()
&& focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
- qApp->inputPanel()->update(Qt::ImEnabled);
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
#endif //QT_NO_IM
break;
#ifndef QT_NO_IM
if (qApp->focusObject() == this) {
if (!on)
- qApp->inputPanel()->reset();
- qApp->inputPanel()->update(Qt::ImEnabled);
+ qApp->inputMethod()->reset();
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
#endif //QT_NO_IM
break;
void QWidget::updateMicroFocus()
{
// updating everything since this is currently called for any kind of state change
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
#ifndef QT_NO_ACCESSIBILITY
if (isVisible()) {
#include "QtCore/qlocale.h"
#include "QtCore/qset.h"
#include "QtGui/qregion.h"
-#include "QtGui/qinputpanel.h"
+#include "QtGui/qinputmethod.h"
#include "QtWidgets/qsizepolicy.h"
#include "QtWidgets/qstyle.h"
#include "QtWidgets/qapplication.h"
void syncBackingStore();
void syncBackingStore(const QRegion ®ion);
- // tells the input panel about the widgets transform
+ // tells the input method about the widgets transform
void updateWidgetTransform();
void reparentFocusWidgets(QWidget *oldtlw);
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
- qApp->inputPanel()->show();
+ qApp->inputMethod()->show();
}
}
}
}
if (qApp) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
QScrollBar *sb = view()->horizontalScrollBar();
void QLineEdit::clear()
{
Q_D(QLineEdit);
- d->resetInputPanel();
+ d->resetInputMethod();
d->control->clear();
}
void QLineEdit::undo()
{
Q_D(QLineEdit);
- d->resetInputPanel();
+ d->resetInputMethod();
d->control->undo();
}
void QLineEdit::redo()
{
Q_D(QLineEdit);
- d->resetInputPanel();
+ d->resetInputMethod();
d->control->redo();
}
#include "qaccessible.h"
#endif
#ifndef QT_NO_IM
-#include "qinputpanel.h"
+#include "qinputmethod.h"
#include "qlist.h"
#endif
q->setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod());
}
-void QLineEditPrivate::resetInputPanel()
+void QLineEditPrivate::resetInputMethod()
{
Q_Q(QLineEdit);
if (q->hasFocus() && qApp) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
}
/*!
This function is not intended as polymorphic usage. Just a shared code
- fragment that calls QInputPanel::invokeAction for this
+ fragment that calls QInputMethod::invokeAction for this
class.
*/
bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
if (mousePos >= 0) {
if (e->type() == QEvent::MouseButtonRelease)
- qApp->inputPanel()->invokeAction(QInputPanel::Click, mousePos);
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, mousePos);
return true;
}
void updatePasswordEchoEditing(bool);
- void resetInputPanel();
+ void resetInputMethod();
inline bool shouldEnableInputMethod() const
{
if (!composeMode())
return;
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
if (!m_tentativeCommit.isEmpty()) {
internalInsert(m_tentativeCommit);
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qpointer.h"
#include "QtGui/qclipboard.h"
-#include "QtGui/qinputpanel.h"
+#include "QtGui/qinputmethod.h"
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"
#include "QtCore/qthread.h"
void setText(const QString &txt)
{
if (composeMode())
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
m_tentativeCommit.clear();
internalSetText(txt, -1, false);
}
Qt::LayoutDirection layoutDirection() const {
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
if (m_text.isEmpty())
- return qApp->inputPanel()->inputDirection();
+ return qApp->inputMethod()->inputDirection();
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
}
return m_layoutDirection;
#include <qvariant.h>
#include <qurl.h>
#include <qdesktopservices.h>
-#include <qinputpanel.h>
+#include <qinputmethod.h>
#include <qtooltip.h>
#include <qstyleoption.h>
#include <QtWidgets/qlineedit.h>
_q_updateCurrentCharFormatAndSelection();
#ifndef QT_NO_IM
if (contextWidget)
- qApp->inputPanel()->update(Qt::ImQueryInput);
+ qApp->inputMethod()->update(Qt::ImQueryInput);
#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
if (cursorPos >= 0) {
if (e->type() == QEvent::MouseButtonRelease)
- qApp->inputPanel()->invokeAction(QInputPanel::Click, cursorPos);
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
e->setAccepted(true);
return true;
return;
cursor.beginEditBlock();
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
if (!tentativeCommit.isEmpty()) {
cursor.insertText(tentativeCommit);
qfileopenevent \
qguimetatype \
qguivariant \
- qinputpanel \
+ qinputmethod \
qkeysequence \
qmouseevent \
qmouseevent_modal \
--- /dev/null
+CONFIG += testcase
+TARGET = tst_qinputmethod
+SOURCES += tst_qinputmethod.cpp
+QT += core-private gui-private testlib
#include <QtTest/QtTest>
#include <private/qguiapplication_p.h>
-#include <private/qinputpanel_p.h>
+#include <private/qinputmethod_p.h>
#include <qplatforminputcontext_qpa.h>
class PlatformInputContext : public QPlatformInputContext
m_localeCallCount(0),
m_inputDirectionCallCount(0),
m_lastQueries(Qt::ImhNone),
- m_action(QInputPanel::Click),
+ m_action(QInputMethod::Click),
m_cursorPosition(0),
m_lastEventType(QEvent::None)
{}
m_updateCallCount++;
m_lastQueries = queries;
}
- virtual void invokeAction(QInputPanel::Action action, int cursorPosition)
+ virtual void invokeAction(QInputMethod::Action action, int cursorPosition)
{
m_action = action;
m_cursorPosition = cursorPosition;
mutable int m_localeCallCount;
mutable int m_inputDirectionCallCount;
Qt::InputMethodQueries m_lastQueries;
- QInputPanel::Action m_action;
+ QInputMethod::Action m_action;
int m_cursorPosition;
int m_lastEventType;
QRectF m_keyboardRect;
Qt::InputMethodQueries m_lastQueries;
};
-class tst_qinputpanel : public QObject
+class tst_qinputmethod : public QObject
{
Q_OBJECT
public:
- tst_qinputpanel() {}
- virtual ~tst_qinputpanel() {}
+ tst_qinputmethod() {}
+ virtual ~tst_qinputmethod() {}
private slots:
void initTestCase();
void visible();
PlatformInputContext m_platformInputContext;
};
-void tst_qinputpanel::initTestCase()
+void tst_qinputmethod::initTestCase()
{
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &m_platformInputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &m_platformInputContext;
}
-void tst_qinputpanel::visible()
+void tst_qinputmethod::visible()
{
- QCOMPARE(qApp->inputPanel()->visible(), false);
- qApp->inputPanel()->show();
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
+ qApp->inputMethod()->show();
+ QCOMPARE(qApp->inputMethod()->visible(), true);
- qApp->inputPanel()->hide();
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputMethod()->hide();
+ QCOMPARE(qApp->inputMethod()->visible(), false);
- qApp->inputPanel()->setVisible(true);
- QCOMPARE(qApp->inputPanel()->visible(), true);
+ qApp->inputMethod()->setVisible(true);
+ QCOMPARE(qApp->inputMethod()->visible(), true);
- qApp->inputPanel()->setVisible(false);
- QCOMPARE(qApp->inputPanel()->visible(), false);
+ qApp->inputMethod()->setVisible(false);
+ QCOMPARE(qApp->inputMethod()->visible(), false);
}
-void tst_qinputpanel::animating()
+void tst_qinputmethod::animating()
{
- QCOMPARE(qApp->inputPanel()->isAnimating(), false);
+ QCOMPARE(qApp->inputMethod()->isAnimating(), false);
m_platformInputContext.m_animating = true;
- QCOMPARE(qApp->inputPanel()->isAnimating(), true);
+ QCOMPARE(qApp->inputMethod()->isAnimating(), true);
m_platformInputContext.m_animating = false;
- QCOMPARE(qApp->inputPanel()->isAnimating(), false);
+ QCOMPARE(qApp->inputMethod()->isAnimating(), false);
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(animatingChanged()));
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(animatingChanged()));
m_platformInputContext.emitAnimatingChanged();
QCOMPARE(spy.count(), 1);
}
-void tst_qinputpanel::keyboarRectangle()
+void tst_qinputmethod::keyboarRectangle()
{
- QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF());
+ QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF());
m_platformInputContext.m_keyboardRect = QRectF(10, 20, 30, 40);
- QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF(10, 20, 30, 40));
+ QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40));
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(keyboardRectangleChanged()));
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(keyboardRectangleChanged()));
m_platformInputContext.emitKeyboardRectChanged();
QCOMPARE(spy.count(), 1);
}
-void tst_qinputpanel::inputItem()
+void tst_qinputmethod::inputItem()
{
- QVERIFY(!qApp->inputPanel()->inputItem());
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(inputItemChanged()));
+ QVERIFY(!qApp->inputMethod()->inputItem());
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(inputItemChanged()));
- qApp->inputPanel()->setInputItem(&m_inputItem);
+ qApp->inputMethod()->setInputItem(&m_inputItem);
- QCOMPARE(qApp->inputPanel()->inputItem(), &m_inputItem);
+ QCOMPARE(qApp->inputMethod()->inputItem(), &m_inputItem);
QCOMPARE(spy.count(), 1);
// reset
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->setInputItem(0);
}
-void tst_qinputpanel::inputItemTransform()
+void tst_qinputmethod::inputItemTransform()
{
- QCOMPARE(qApp->inputPanel()->inputItemTransform(), QTransform());
- QSignalSpy spy(qApp->inputPanel(), SIGNAL(cursorRectangleChanged()));
+ QCOMPARE(qApp->inputMethod()->inputItemTransform(), QTransform());
+ QSignalSpy spy(qApp->inputMethod(), SIGNAL(cursorRectangleChanged()));
QTransform transform;
transform.translate(10, 10);
transform.scale(2, 2);
transform.shear(2, 2);
- qApp->inputPanel()->setInputItemTransform(transform);
+ qApp->inputMethod()->setInputItemTransform(transform);
- QCOMPARE(qApp->inputPanel()->inputItemTransform(), transform);
+ QCOMPARE(qApp->inputMethod()->inputItemTransform(), transform);
QCOMPARE(spy.count(), 1);
// reset
- qApp->inputPanel()->setInputItemTransform(QTransform());
+ qApp->inputMethod()->setInputItemTransform(QTransform());
}
-void tst_qinputpanel::cursorRectangle()
+void tst_qinputmethod::cursorRectangle()
{
- QCOMPARE(qApp->inputPanel()->cursorRectangle(), QRectF());
+ QCOMPARE(qApp->inputMethod()->cursorRectangle(), QRectF());
QTransform transform;
transform.translate(10, 10);
transform.scale(2, 2);
transform.shear(2, 2);
- qApp->inputPanel()->setInputItemTransform(transform);
- qApp->inputPanel()->setInputItem(&m_inputItem);
+ qApp->inputMethod()->setInputItemTransform(transform);
+ qApp->inputMethod()->setInputItem(&m_inputItem);
- QCOMPARE(qApp->inputPanel()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4)));
+ QCOMPARE(qApp->inputMethod()->cursorRectangle(), transform.mapRect(QRectF(1, 2, 3, 4)));
// reset
- qApp->inputPanel()->setInputItem(0);
- qApp->inputPanel()->setInputItemTransform(QTransform());
+ qApp->inputMethod()->setInputItem(0);
+ qApp->inputMethod()->setInputItemTransform(QTransform());
}
-void tst_qinputpanel::invokeAction()
+void tst_qinputmethod::invokeAction()
{
- QCOMPARE(m_platformInputContext.m_action, QInputPanel::Click);
+ QCOMPARE(m_platformInputContext.m_action, QInputMethod::Click);
QCOMPARE(m_platformInputContext.m_cursorPosition, 0);
- qApp->inputPanel()->invokeAction(QInputPanel::ContextMenu, 5);
- QCOMPARE(m_platformInputContext.m_action, QInputPanel::ContextMenu);
+ qApp->inputMethod()->invokeAction(QInputMethod::ContextMenu, 5);
+ QCOMPARE(m_platformInputContext.m_action, QInputMethod::ContextMenu);
QCOMPARE(m_platformInputContext.m_cursorPosition, 5);
}
-void tst_qinputpanel::reset()
+void tst_qinputmethod::reset()
{
QCOMPARE(m_platformInputContext.m_resetCallCount, 0);
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
QCOMPARE(m_platformInputContext.m_resetCallCount, 1);
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
QCOMPARE(m_platformInputContext.m_resetCallCount, 2);
}
-void tst_qinputpanel::commit()
+void tst_qinputmethod::commit()
{
QCOMPARE(m_platformInputContext.m_commitCallCount, 0);
- qApp->inputPanel()->commit();
+ qApp->inputMethod()->commit();
QCOMPARE(m_platformInputContext.m_commitCallCount, 1);
- qApp->inputPanel()->commit();
+ qApp->inputMethod()->commit();
QCOMPARE(m_platformInputContext.m_commitCallCount, 2);
}
-void tst_qinputpanel::update()
+void tst_qinputmethod::update()
{
- qApp->inputPanel()->setInputItem(&m_inputItem);
+ qApp->inputMethod()->setInputItem(&m_inputItem);
QCOMPARE(m_platformInputContext.m_updateCallCount, 0);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImhNone));
- qApp->inputPanel()->update(Qt::ImQueryInput);
+ qApp->inputMethod()->update(Qt::ImQueryInput);
QCOMPARE(m_platformInputContext.m_updateCallCount, 1);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryInput));
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
QCOMPARE(m_platformInputContext.m_updateCallCount, 2);
QCOMPARE(int(m_platformInputContext.m_lastQueries), int(Qt::ImQueryAll));
- QCOMPARE(qApp->inputPanel()->keyboardRectangle(), QRectF(10, 20, 30, 40));
+ QCOMPARE(qApp->inputMethod()->keyboardRectangle(), QRectF(10, 20, 30, 40));
// reset
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->setInputItem(0);
}
-void tst_qinputpanel::query()
+void tst_qinputmethod::query()
{
QInputMethodQueryEvent query(Qt::InputMethodQueries(Qt::ImPreferredLanguage | Qt::ImCursorRectangle));
QGuiApplication::sendEvent(&m_inputItem, &query);
QCOMPARE(cursorRectangle, QRect(1,2,3,4));
}
-void tst_qinputpanel::inputDirection()
+void tst_qinputmethod::inputDirection()
{
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 0);
- qApp->inputPanel()->inputDirection();
+ qApp->inputMethod()->inputDirection();
QCOMPARE(m_platformInputContext.m_inputDirectionCallCount, 1);
QCOMPARE(m_platformInputContext.m_localeCallCount, 0);
- qApp->inputPanel()->locale();
+ qApp->inputMethod()->locale();
QCOMPARE(m_platformInputContext.m_localeCallCount, 1);
}
-QTEST_MAIN(tst_qinputpanel)
-#include "tst_qinputpanel.moc"
+QTEST_MAIN(tst_qinputmethod)
+#include "tst_qinputmethod.moc"
+++ /dev/null
-CONFIG += testcase
-TARGET = tst_qinputpanel
-SOURCES += tst_qinputpanel.cpp
-QT += core-private gui-private testlib
#include <math.h>
#include "../../../gui/painting/qpathclipper/pathcompare.h"
#include "../../shared/platforminputcontext.h"
-#include <private/qinputpanel_p.h>
+#include <private/qinputmethod_p.h>
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
#include <windows.h>
void tst_QGraphicsScene::cleanup()
{
// ensure not even skipped tests with custom input context leave it dangling
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = 0;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
}
void tst_QGraphicsScene::construction()
void tst_QGraphicsScene::inputMethod()
{
PlatformInputContext inputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &inputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &inputContext;
QFETCH(int, flags);
QFETCH(bool, callFocusItem);
#include <private/qgraphicsview_p.h>
#include "../../../platformquirks.h"
#include "../../shared/platforminputcontext.h"
-#include <private/qinputpanel_p.h>
+#include <private/qinputmethod_p.h>
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QList<QRectF>)
void tst_QGraphicsView::cleanup()
{
// ensure not even skipped tests with custom input context leave it dangling
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = 0;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = 0;
}
void tst_QGraphicsView::construction()
void tst_QGraphicsView::inputContextReset()
{
PlatformInputContext inputContext;
- QInputPanelPrivate *inputPanelPrivate = QInputPanelPrivate::get(qApp->inputPanel());
- inputPanelPrivate->testContext = &inputContext;
+ QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod());
+ inputMethodPrivate->testContext = &inputContext;
QGraphicsScene scene;
QGraphicsView view(&scene);
widget->winId(); // make sure, widget has been created
widget->show();
QTRY_VERIFY(widget->hasFocus());
- QCOMPARE(qApp->inputPanel()->inputItem(), static_cast<QWidget*>(widget));
+ QCOMPARE(qApp->inputMethod()->inputItem(), static_cast<QWidget*>(widget));
widget->setReadOnly(true);
- QVERIFY(!qApp->inputPanel()->inputItem());
+ QVERIFY(!qApp->inputMethod()->inputItem());
delete widget;
}