Fix TextInput and TextEdit open/closeSoftwareInputPanel functions
authorJoona Petrell <joona.t.petrell@nokia.com>
Thu, 8 Sep 2011 09:09:22 +0000 (12:09 +0300)
committerLars Knoll <lars.knoll@nokia.com>
Thu, 8 Sep 2011 11:40:50 +0000 (13:40 +0200)
Change-Id: I69bac4d1ce55271685dcddcc4c8ad2f6598e7630
Reviewed-on: http://codereview.qt-project.org/4439
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
src/declarative/items/qsgtextedit.cpp
src/declarative/items/qsgtextinput.cpp

index 74f3450..1afb36f 100644 (file)
@@ -1919,12 +1919,8 @@ void QSGTextEditPrivate::updateDefaultTextOption()
 */
 void QSGTextEdit::openSoftwareInputPanel()
 {
-    if (qApp) {
-        if (canvas()) {
-            QEvent event(QEvent::RequestSoftwareInputPanel);
-            QGuiApplication::sendEvent(canvas(), &event);
-        }
-    }
+    if (qGuiApp)
+        qGuiApp->inputPanel()->show();
 }
 
 /*!
@@ -1968,12 +1964,8 @@ void QSGTextEdit::openSoftwareInputPanel()
 */
 void QSGTextEdit::closeSoftwareInputPanel()
 {  
-    if (qApp) {
-        if (canvas()) {
-            QEvent event(QEvent::CloseSoftwareInputPanel);
-            QGuiApplication::sendEvent(canvas(), &event);
-        }
-    }
+    if (qGuiApp)
+        qGuiApp->inputPanel()->show();
 }
 
 void QSGTextEdit::focusInEvent(QFocusEvent *event)
index 7a58698..42105cf 100644 (file)
@@ -1732,12 +1732,8 @@ void QSGTextInput::moveCursorSelection(int pos, SelectionMode mode)
 */
 void QSGTextInput::openSoftwareInputPanel()
 {
-    if (qApp) {
-        if (canvas()) {
-            QEvent event(QEvent::RequestSoftwareInputPanel);
-            QCoreApplication::sendEvent(canvas(), &event);
-        }
-    }
+    if (qGuiApp)
+        qGuiApp->inputPanel()->show();
 }
 
 /*!
@@ -1781,12 +1777,8 @@ void QSGTextInput::openSoftwareInputPanel()
 */
 void QSGTextInput::closeSoftwareInputPanel()
 {
-    if (qApp) {
-        if (canvas()) {
-            QEvent event(QEvent::CloseSoftwareInputPanel);
-            QCoreApplication::sendEvent(canvas(), &event);
-        }
-    }
+    if (qGuiApp)
+        qGuiApp->inputPanel()->hide();
 }
 
 void QSGTextInput::focusInEvent(QFocusEvent *event)