From f034d804b76eacbf59a2dbb1f240d741fee0957a Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 8 Sep 2011 12:09:22 +0300 Subject: [PATCH] Fix TextInput and TextEdit open/closeSoftwareInputPanel functions Change-Id: I69bac4d1ce55271685dcddcc4c8ad2f6598e7630 Reviewed-on: http://codereview.qt-project.org/4439 Reviewed-by: Qt Sanity Bot Reviewed-by: Lars Knoll --- src/declarative/items/qsgtextedit.cpp | 16 ++++------------ src/declarative/items/qsgtextinput.cpp | 16 ++++------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/declarative/items/qsgtextedit.cpp b/src/declarative/items/qsgtextedit.cpp index 74f3450..1afb36f 100644 --- a/src/declarative/items/qsgtextedit.cpp +++ b/src/declarative/items/qsgtextedit.cpp @@ -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) diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp index 7a58698..42105cf 100644 --- a/src/declarative/items/qsgtextinput.cpp +++ b/src/declarative/items/qsgtextinput.cpp @@ -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) -- 2.7.4