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>
bb10
Pekka Vuorela 2012-01-24 17:44:38 +02:00 committed by Qt by Nokia
parent b2b3abe0eb
commit 71726ccf67
34 changed files with 498 additions and 369 deletions

View File

@ -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 \

View File

@ -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();
}

View File

@ -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();

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -54,7 +54,7 @@
#include <private/qunicodetables_p.h>
#include "qtextdocument_p.h"
#include <qguiapplication.h>
#include <qinputpanel.h>
#include <qinputmethod.h>
#include <stdlib.h>
@ -1409,7 +1409,7 @@ bool QTextEngine::isRightToLeft() const
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();
}

View File

@ -88,7 +88,7 @@ QIBusPlatformInputContext::QIBusPlatformInputContext ()
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()));
}
@ -103,12 +103,12 @@ bool QIBusPlatformInputContext::isValid() const
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();
}
@ -130,7 +130,7 @@ void QIBusPlatformInputContext::commit()
if (!d->valid)
return;
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (!input) {
d->predit = QString();
return;
@ -155,11 +155,11 @@ void QIBusPlatformInputContext::cursorRectChanged()
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()));
@ -173,7 +173,7 @@ void QIBusPlatformInputContext::inputItemChanged()
if (!d->valid)
return;
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (debug)
qDebug() << "setFocusObject" << input;
if (input)
@ -184,7 +184,7 @@ void QIBusPlatformInputContext::inputItemChanged()
void QIBusPlatformInputContext::commitText(const QDBusVariant &text)
{
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
@ -206,7 +206,7 @@ void QIBusPlatformInputContext::commitText(const QDBusVariant &text)
void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint cursorPos, bool visible)
{
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;

View File

@ -182,8 +182,8 @@ QMaliitPlatformInputContext::QMaliitPlatformInputContext()
{
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)
@ -196,13 +196,13 @@ bool QMaliitPlatformInputContext::isValid() const
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;
@ -220,7 +220,7 @@ void QMaliitPlatformInputContext::invokeAction(QInputPanel::Action action, int x
void QMaliitPlatformInputContext::reset()
{
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
const bool hadPreedit = !d->preedit.isEmpty();
if (hadPreedit && input) {
@ -238,8 +238,8 @@ void QMaliitPlatformInputContext::reset()
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;
@ -254,8 +254,8 @@ void QMaliitPlatformInputContext::update(Qt::InputMethodQueries queries)
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());
}
@ -289,7 +289,7 @@ void QMaliitPlatformInputContext::activationLostEvent()
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;
@ -305,7 +305,7 @@ void QMaliitPlatformInputContext::commitString(const QString &string, int replac
void QMaliitPlatformInputContext::updatePreedit(const QDBusMessage &message)
{
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
@ -421,7 +421,7 @@ void QMaliitPlatformInputContext::paste()
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();
@ -435,7 +435,7 @@ bool QMaliitPlatformInputContext::selection(QString &selection)
{
selection.clear();
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return false;
@ -471,7 +471,7 @@ void QMaliitPlatformInputContext::setRedirectKeys(bool)
void QMaliitPlatformInputContext::setSelection(int start, int length)
{
QObject *input = qApp->inputPanel()->inputItem();
QObject *input = qApp->inputMethod()->inputItem();
if (!input)
return;
@ -497,9 +497,9 @@ void QMaliitPlatformInputContext::inputItemChanged()
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)),
@ -533,8 +533,8 @@ void QMaliitPlatformInputContext::showInputPanel()
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();

View File

@ -167,7 +167,7 @@ QWindowsInputContext::QWindowsInputContext() :
m_WM_MSIME_MOUSE(RegisterWindowMessage(L"MSIMEMouseOperation")),
m_endCompositionRecursionGuard(false)
{
connect(qApp->inputPanel(), SIGNAL(cursorRectangleChanged()),
connect(qApp->inputMethod(), SIGNAL(cursorRectangleChanged()),
this, SLOT(cursorRectChanged()));
}
@ -184,7 +184,7 @@ void QWindowsInputContext::reset()
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)
@ -213,8 +213,8 @@ void QWindowsInputContext::cursorRectChanged()
{
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;
@ -249,9 +249,9 @@ void QWindowsInputContext::cursorRectChanged()
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;
}
@ -329,11 +329,11 @@ static inline QTextFormat standardFormat(StandardFormat format)
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)
@ -397,7 +397,7 @@ static inline QList<QInputMethodEvent::Attribute>
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)
@ -459,7 +459,7 @@ bool QWindowsInputContext::endComposition(HWND hwnd)
// 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;
@ -537,7 +537,7 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
{
QObject *fo = qApp->inputPanel()->inputItem();
QObject *fo = qApp->inputMethod()->inputItem();
if (!fo)
return false;

View File

@ -743,7 +743,7 @@
#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"
@ -7379,7 +7379,7 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
QWidget *fw = QApplication::focusWidget();
if (!fw)
return;
qApp->inputPanel()->update(Qt::ImHints);
qApp->inputMethod()->update(Qt::ImHints);
}
/*!
@ -7397,7 +7397,7 @@ void QGraphicsItem::updateMicroFocus()
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
@ -10215,9 +10215,9 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event)
// 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:

View File

@ -243,7 +243,7 @@
#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>
@ -822,7 +822,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// the views, but if we are changing focus, we have to
// do it ourselves.
if (qApp)
qApp->inputPanel()->reset();
qApp->inputMethod()->reset();
}
focusItem = 0;

View File

@ -69,7 +69,7 @@
#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"
@ -1976,7 +1976,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
// 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
@ -3873,10 +3873,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break;
}
case QEvent::RequestSoftwareInputPanel:
inputPanel()->show();
inputMethod()->show();
break;
case QEvent::CloseSoftwareInputPanel:
inputPanel()->hide();
inputMethod()->hide();
break;
#ifndef QT_NO_GESTURES
@ -4886,22 +4886,22 @@ QInputContext *QApplication::inputContext() const
\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)

View File

@ -65,7 +65,7 @@
#include "qmenu.h"
#include "qtextformat.h"
#include "qpalette.h"
#include <QtGui/qinputpanel.h>
#include <QtGui/qinputmethod.h>
#include <QtGui/qevent.h>
#include <stdlib.h>
@ -228,7 +228,7 @@ void QInputContext::setFocusWidget(QWidget *widget)
void QInputContext::sendEvent(const QInputMethodEvent &event)
{
QObject *focus = qApp->inputPanel()->inputItem();
QObject *focus = qApp->inputMethod()->inputItem();
if (!focus)
return;
@ -257,7 +257,7 @@ void QInputContext::sendEvent(const QInputMethodEvent &event)
void QInputContext::mouseHandler(int x, QMouseEvent *event)
{
if (event->type() == QEvent::MouseButtonRelease)
qApp->inputPanel()->invokeAction(QInputPanel::Click, x);
qApp->inputMethod()->invokeAction(QInputMethod::Click, x);
}
@ -280,7 +280,7 @@ QFont QInputContext::font() const
*/
void QInputContext::update()
{
qApp->inputPanel()->update(Qt::ImQueryAll);
qApp->inputMethod()->update(Qt::ImQueryAll);
}
/*!
@ -291,7 +291,7 @@ void QInputContext::update()
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
}
/*!
@ -316,7 +316,7 @@ void QInputContext::widgetDestroyed(QWidget *widget)
*/
void QInputContext::reset()
{
qApp->inputPanel()->reset();
qApp->inputMethod()->reset();
}

View File

@ -78,7 +78,7 @@
#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>
@ -354,7 +354,7 @@ void QWidgetPrivate::updateWidgetTransform()
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);
}
}
@ -3106,10 +3106,10 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
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
@ -8811,7 +8811,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
#ifndef QT_NO_IM
Q_D(QWidget);
d->imHints = hints;
qApp->inputPanel()->update(Qt::ImHints);
qApp->inputMethod()->update(Qt::ImHints);
#endif //QT_NO_IM
}
@ -10030,8 +10030,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
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
@ -10045,7 +10045,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
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;
@ -10080,8 +10080,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
#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;
@ -10513,7 +10513,7 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable)
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()) {

View File

@ -59,7 +59,7 @@
#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"
@ -416,7 +416,7 @@ public:
void syncBackingStore();
void syncBackingStore(const QRegion &region);
// tells the input panel about the widgets transform
// tells the input method about the widgets transform
void updateWidgetTransform();
void reparentFocusWidgets(QWidget *oldtlw);
@ -573,7 +573,7 @@ public:
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
qApp->inputPanel()->show();
qApp->inputMethod()->show();
}
}
}

View File

@ -2458,7 +2458,7 @@ void QComboBox::showPopup()
}
if (qApp) {
qApp->inputPanel()->reset();
qApp->inputMethod()->reset();
}
QScrollBar *sb = view()->horizontalScrollBar();

View File

@ -1202,7 +1202,7 @@ void QLineEdit::insert(const QString &newText)
void QLineEdit::clear()
{
Q_D(QLineEdit);
d->resetInputPanel();
d->resetInputMethod();
d->control->clear();
}
@ -1215,7 +1215,7 @@ void QLineEdit::clear()
void QLineEdit::undo()
{
Q_D(QLineEdit);
d->resetInputPanel();
d->resetInputMethod();
d->control->undo();
}
@ -1226,7 +1226,7 @@ void QLineEdit::undo()
void QLineEdit::redo()
{
Q_D(QLineEdit);
d->resetInputPanel();
d->resetInputMethod();
d->control->redo();
}

View File

@ -51,7 +51,7 @@
#include "qaccessible.h"
#endif
#ifndef QT_NO_IM
#include "qinputpanel.h"
#include "qinputmethod.h"
#include "qlist.h"
#endif
@ -242,17 +242,17 @@ void QLineEditPrivate::updatePasswordEchoEditing(bool editing)
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 )
@ -266,7 +266,7 @@ 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;
}

View File

@ -102,7 +102,7 @@ public:
void updatePasswordEchoEditing(bool);
void resetInputPanel();
void resetInputMethod();
inline bool shouldEnableInputMethod() const
{

View File

@ -206,7 +206,7 @@ void QWidgetLineControl::commitPreedit()
if (!composeMode())
return;
qApp->inputPanel()->reset();
qApp->inputMethod()->reset();
if (!m_tentativeCommit.isEmpty()) {
internalInsert(m_tentativeCommit);

View File

@ -62,7 +62,7 @@
#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"
@ -232,7 +232,7 @@ public:
void setText(const QString &txt)
{
if (composeMode())
qApp->inputPanel()->reset();
qApp->inputMethod()->reset();
m_tentativeCommit.clear();
internalSetText(txt, -1, false);
}
@ -318,7 +318,7 @@ public:
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;

View File

@ -75,7 +75,7 @@
#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>
@ -1689,7 +1689,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button
_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)));
@ -1836,7 +1836,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext(
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;
@ -2755,7 +2755,7 @@ void QWidgetTextControlPrivate::commitPreedit()
return;
cursor.beginEditBlock();
qApp->inputPanel()->reset();
qApp->inputMethod()->reset();
if (!tentativeCommit.isEmpty()) {
cursor.insertText(tentativeCommit);

View File

@ -6,7 +6,7 @@ SUBDIRS=\
qfileopenevent \
qguimetatype \
qguivariant \
qinputpanel \
qinputmethod \
qkeysequence \
qmouseevent \
qmouseevent_modal \

View File

@ -0,0 +1,4 @@
CONFIG += testcase
TARGET = tst_qinputmethod
SOURCES += tst_qinputmethod.cpp
QT += core-private gui-private testlib

View File

@ -42,7 +42,7 @@
#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
@ -57,7 +57,7 @@ public:
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)
{}
@ -72,7 +72,7 @@ public:
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;
@ -112,7 +112,7 @@ public:
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;
@ -139,12 +139,12 @@ public:
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();
@ -164,158 +164,158 @@ private:
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);
@ -327,16 +327,16 @@ void tst_qinputpanel::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"

View File

@ -1,4 +0,0 @@
CONFIG += testcase
TARGET = tst_qinputpanel
SOURCES += tst_qinputpanel.cpp
QT += core-private gui-private testlib

View File

@ -52,7 +52,7 @@
#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>
@ -295,8 +295,8 @@ void tst_QGraphicsScene::initTestCase()
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()
@ -3766,8 +3766,8 @@ public:
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);

View File

@ -72,7 +72,7 @@
#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>)
@ -264,8 +264,8 @@ void tst_QGraphicsView::initTestCase()
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()
@ -4109,8 +4109,8 @@ void tst_QGraphicsView::inputMethodSensitivity()
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);

View File

@ -8891,9 +8891,9 @@ void tst_QWidget::inputFocus_task257832()
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;
}