aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-06-22 16:00:08 +1000
committerQt by Nokia <qt-info@nokia.com>2012-06-22 08:18:15 +0200
commit3721de405e8556a25b66f7bc4bc946ba35b45292 (patch)
treef1bd35e5bce63b23ae39b7c2a5640b6532b53298 /src
parentb46d5a53c80580eb241dfd8751118cf6893d5cf8 (diff)
Remove the open and closeSofwareInputPanel functions.
Functionality is provided by the global Qt.application.inputMethod object. Task-number: QTBUG-21449 Change-Id: I75c082bcbe44c8834ccaf966a3f9a09ab91ec290 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquicktextedit.cpp92
-rw-r--r--src/quick/items/qquicktextedit_p.h3
-rw-r--r--src/quick/items/qquicktextinput.cpp90
-rw-r--r--src/quick/items/qquicktextinput_p.h3
4 files changed, 4 insertions, 184 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 058b8161c4..52067855ba 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1480,7 +1480,7 @@ void QQuickTextEdit::mousePressEvent(QMouseEvent *event)
forceActiveFocus();
// re-open input panel on press if already focused
if (hasActiveFocus() && hadActiveFocus && !isReadOnly())
- openSoftwareInputPanel();
+ qGuiApp->inputMethod()->show();
}
if (!event->isAccepted())
QQuickImplicitSizeItem::mousePressEvent(event);
@@ -2044,99 +2044,11 @@ void QQuickTextEditPrivate::updateDefaultTextOption()
}
}
-
-
-/*!
- \qmlmethod void QtQuick2::TextEdit::openSoftwareInputPanel()
-
- Opens software input panels like virtual keyboards for typing, useful for
- customizing when you want the input keyboard to be shown and hidden in
- your application.
-
- By default the opening of input panels follows the platform style. Input panels are
- always closed if no editor has active focus.
-
- You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
- and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
- the behavior you want.
-
- Only relevant on platforms, which provide virtual keyboards.
-
- \code
- import QtQuick 2.0
- TextEdit {
- id: textEdit
- text: "Hello world!"
- activeFocusOnPress: false
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (!textEdit.activeFocus) {
- textEdit.forceActiveFocus();
- textEdit.openSoftwareInputPanel();
- } else {
- textEdit.focus = false;
- }
- }
- onPressAndHold: textEdit.closeSoftwareInputPanel();
- }
- }
- \endcode
-*/
-void QQuickTextEdit::openSoftwareInputPanel()
-{
- if (qGuiApp)
- qGuiApp->inputMethod()->show();
-}
-
-/*!
- \qmlmethod void QtQuick2::TextEdit::closeSoftwareInputPanel()
-
- Closes a software input panel like a virtual keyboard shown on the screen, useful
- for customizing when you want the input keyboard to be shown and hidden in
- your application.
-
- By default the opening of input panels follows the platform style. Input panels are
- always closed if no editor has active focus.
-
- You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
- and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
- the behavior you want.
-
- Only relevant on platforms, which provide virtual keyboards.
-
- \code
- import QtQuick 2.0
- TextEdit {
- id: textEdit
- text: "Hello world!"
- activeFocusOnPress: false
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (!textEdit.activeFocus) {
- textEdit.forceActiveFocus();
- textEdit.openSoftwareInputPanel();
- } else {
- textEdit.focus = false;
- }
- }
- onPressAndHold: textEdit.closeSoftwareInputPanel();
- }
- }
- \endcode
-*/
-void QQuickTextEdit::closeSoftwareInputPanel()
-{
- if (qGuiApp)
- qGuiApp->inputMethod()->hide();
-}
-
void QQuickTextEdit::focusInEvent(QFocusEvent *event)
{
Q_D(const QQuickTextEdit);
if (d->focusOnPress && !isReadOnly())
- openSoftwareInputPanel();
+ qGuiApp->inputMethod()->show();
QQuickImplicitSizeItem::focusInEvent(event);
}
diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h
index 48954cc7d6..b19873c2fa 100644
--- a/src/quick/items/qquicktextedit_p.h
+++ b/src/quick/items/qquicktextedit_p.h
@@ -130,9 +130,6 @@ public:
SelectWords
};
- Q_INVOKABLE void openSoftwareInputPanel();
- Q_INVOKABLE void closeSoftwareInputPanel();
-
QString text() const;
void setText(const QString &);
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index a8d10f3daf..0d05d6f9d7 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -1451,7 +1451,7 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event)
forceActiveFocus();
// re-open input panel on press if already focused
if (hasActiveFocus() && hadActiveFocus && !d->m_readOnly)
- openSoftwareInputPanel();
+ qGuiApp->inputMethod()->show();
}
event->setAccepted(true);
@@ -2372,97 +2372,11 @@ void QQuickTextInput::moveCursorSelection(int pos, SelectionMode mode)
}
}
-/*!
- \qmlmethod void QtQuick2::TextInput::openSoftwareInputPanel()
-
- Opens software input panels like virtual keyboards for typing, useful for
- customizing when you want the input keyboard to be shown and hidden in
- your application.
-
- By default the opening of input panels follows the platform style. Input panels are
- always closed if no editor has active focus.
-
- You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
- and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
- the behavior you want.
-
- Only relevant on platforms, which provide virtual keyboards.
-
- \qml
- import QtQuick 2.0
- TextInput {
- id: textInput
- text: "Hello world!"
- activeFocusOnPress: false
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (!textInput.activeFocus) {
- textInput.forceActiveFocus()
- textInput.openSoftwareInputPanel();
- } else {
- textInput.focus = false;
- }
- }
- onPressAndHold: textInput.closeSoftwareInputPanel();
- }
- }
- \endqml
-*/
-void QQuickTextInput::openSoftwareInputPanel()
-{
- if (qGuiApp)
- qGuiApp->inputMethod()->show();
-}
-
-/*!
- \qmlmethod void QtQuick2::TextInput::closeSoftwareInputPanel()
-
- Closes a software input panel like a virtual keyboard shown on the screen, useful
- for customizing when you want the input keyboard to be shown and hidden in
- your application.
-
- By default the opening of input panels follows the platform style. Input panels are
- always closed if no editor has active focus.
-
- You can disable the automatic behavior by setting the property \c activeFocusOnPress to false
- and use functions openSoftwareInputPanel() and closeSoftwareInputPanel() to implement
- the behavior you want.
-
- Only relevant on platforms, which provide virtual keyboards.
-
- \qml
- import QtQuick 2.0
- TextInput {
- id: textInput
- text: "Hello world!"
- activeFocusOnPress: false
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (!textInput.activeFocus) {
- textInput.forceActiveFocus();
- textInput.openSoftwareInputPanel();
- } else {
- textInput.focus = false;
- }
- }
- onPressAndHold: textInput.closeSoftwareInputPanel();
- }
- }
- \endqml
-*/
-void QQuickTextInput::closeSoftwareInputPanel()
-{
- if (qGuiApp)
- qGuiApp->inputMethod()->hide();
-}
-
void QQuickTextInput::focusInEvent(QFocusEvent *event)
{
Q_D(const QQuickTextInput);
if (d->focusOnPress && !d->m_readOnly)
- openSoftwareInputPanel();
+ qGuiApp->inputMethod()->show();
QQuickImplicitSizeItem::focusInEvent(event);
}
diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h
index a7b07898e8..fb21eb910b 100644
--- a/src/quick/items/qquicktextinput_p.h
+++ b/src/quick/items/qquicktextinput_p.h
@@ -157,9 +157,6 @@ public:
Q_INVOKABLE void moveCursorSelection(int pos);
Q_INVOKABLE void moveCursorSelection(int pos, SelectionMode mode);
- Q_INVOKABLE void openSoftwareInputPanel();
- Q_INVOKABLE void closeSoftwareInputPanel();
-
QString text() const;
void setText(const QString &);