From: Pekka Vuorela Date: Thu, 8 Sep 2011 12:12:45 +0000 (+0300) Subject: Fix TextInput and TextEdit software input panel on qtquick1 X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=c8fdb0541b047b73413aa67d4f5aece539e98347;p=konrad%2Fqtdeclarative.git Fix TextInput and TextEdit software input panel on qtquick1 Change-Id: I39da7a877cef546da69bccfcf7ee1ae2ba92b208 Reviewed-on: http://codereview.qt-project.org/4455 Reviewed-by: Qt Sanity Bot Reviewed-by: Lars Knoll --- diff --git a/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp b/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp index 3610515..777d964 100644 --- a/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativetextedit.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include @@ -1807,11 +1808,10 @@ void QDeclarative1TextEditPrivate::updateDefaultTextOption() */ void QDeclarative1TextEdit::openSoftwareInputPanel() { - QEvent event(QEvent::RequestSoftwareInputPanel); if (qApp) { if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { if (view->scene() && view->scene() == scene()) { - QApplication::sendEvent(view, &event); + qApp->inputPanel()->show(); } } } @@ -1858,11 +1858,10 @@ void QDeclarative1TextEdit::openSoftwareInputPanel() */ void QDeclarative1TextEdit::closeSoftwareInputPanel() { - QEvent event(QEvent::CloseSoftwareInputPanel); if (qApp) { if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { if (view->scene() && view->scene() == scene()) { - QApplication::sendEvent(view, &event); + qApp->inputPanel()->hide(); } } } diff --git a/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp b/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp index 271595a..544e35d 100644 --- a/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp +++ b/src/qtquick1/graphicsitems/qdeclarativetextinput.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -1277,7 +1278,6 @@ bool QDeclarative1TextInput::event(QEvent* ev) void QDeclarative1TextInput::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { - Q_D(QDeclarative1TextInput); if (newGeometry.width() != oldGeometry.width()) { updateSize(); updateCursorRectangle(); @@ -1763,11 +1763,10 @@ void QDeclarative1TextInput::moveCursorSelection(int pos, SelectionMode mode) */ void QDeclarative1TextInput::openSoftwareInputPanel() { - QEvent event(QEvent::RequestSoftwareInputPanel); if (qApp) { if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { if (view->scene() && view->scene() == scene()) { - QApplication::sendEvent(view, &event); + qApp->inputPanel()->show(); } } } @@ -1814,12 +1813,10 @@ void QDeclarative1TextInput::openSoftwareInputPanel() */ void QDeclarative1TextInput::closeSoftwareInputPanel() { - QEvent event(QEvent::CloseSoftwareInputPanel); if (qApp) { - QEvent event(QEvent::CloseSoftwareInputPanel); if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { if (view->scene() && view->scene() == scene()) { - QApplication::sendEvent(view, &event); + qApp->inputPanel()->hide(); } } }