diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index ca9d1e69c9b..e3d488b9583 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -519,6 +519,10 @@ bool QAndroidInputContext::isAnimating() const void QAndroidInputContext::showInputPanel() { + if (QGuiApplication::applicationState() != Qt::ApplicationActive) { + connect(qGuiApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(showInputPanelLater(Qt::ApplicationState))); + return; + } QSharedPointer query = focusObjectInputMethodQueryThreadSafe(); if (query.isNull()) return; @@ -541,6 +545,14 @@ void QAndroidInputContext::showInputPanel() query->value(Qt::ImHints).toUInt()); } +void QAndroidInputContext::showInputPanelLater(Qt::ApplicationState state) +{ + if (state != Qt::ApplicationActive) + return; + disconnect(qGuiApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(showInputPanelLater(Qt::ApplicationState))); + showInputPanel(); +} + void QAndroidInputContext::hideInputPanel() { QtAndroidInput::hideSoftwareKeyboard(); diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index 670a0511397..2ebb155d2ac 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -112,6 +112,9 @@ public: public slots: void updateCursorPosition(); +private slots: + void showInputPanelLater(Qt::ApplicationState); + private: void sendInputMethodEventThreadSafe(QInputMethodEvent *event); Q_INVOKABLE void sendInputMethodEventUnsafe(QInputMethodEvent *event);