Remove the open and closeSofwareInputPanel functions.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Fri, 22 Jun 2012 06:00:08 +0000 (16:00 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 22 Jun 2012 06:18:15 +0000 (08:18 +0200)
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>
src/quick/items/qquicktextedit.cpp
src/quick/items/qquicktextedit_p.h
src/quick/items/qquicktextinput.cpp
src/quick/items/qquicktextinput_p.h
tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp

index 058b816..5206785 100644 (file)
@@ -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);
 }
 
index 48954cc..b19873c 100644 (file)
@@ -130,9 +130,6 @@ public:
         SelectWords
     };
 
-    Q_INVOKABLE void openSoftwareInputPanel();
-    Q_INVOKABLE void closeSoftwareInputPanel();
-
     QString text() const;
     void setText(const QString &);
 
index a8d10f3..0d05d6f 100644 (file)
@@ -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);
 }
 
index a7b0789..fb21eb9 100644 (file)
@@ -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 &);
 
index 80d81cc..763c191 100644 (file)
@@ -2656,14 +2656,6 @@ void tst_qquicktextedit::openInputPanel()
     QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
     QCOMPARE(qApp->inputMethod()->isVisible(), false);
 
-    // input panel should open when openSoftwareInputPanel is called
-    edit->openSoftwareInputPanel();
-    QCOMPARE(qApp->inputMethod()->isVisible(), true);
-
-    // input panel should close when closeSoftwareInputPanel is called
-    edit->closeSoftwareInputPanel();
-    QCOMPARE(qApp->inputMethod()->isVisible(), false);
-
     inputMethodPrivate->testContext = 0;
 }
 
index 1742335..5044f48 100644 (file)
@@ -3216,14 +3216,6 @@ void tst_qquicktextinput::openInputPanel()
     QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint);
     QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint);
     QCOMPARE(qApp->inputMethod()->isVisible(), false);
-
-    // input panel should open when openSoftwareInputPanel is called
-    input->openSoftwareInputPanel();
-    QCOMPARE(qApp->inputMethod()->isVisible(), true);
-
-    // input panel should close when closeSoftwareInputPanel is called
-    input->closeSoftwareInputPanel();
-    QCOMPARE(qApp->inputMethod()->isVisible(), false);
 }
 
 class MyTextInput : public QQuickTextInput