diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2014-10-13 13:09:06 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@digia.com> | 2014-10-20 10:23:41 +0200 |
commit | 1faba97683ec42155acd7ed51d14f65bb240bc75 (patch) | |
tree | 2177c5d2c0272f426f59d2f947a90b242172ffb0 /src/plugins/platforms/android/qandroidinputcontext.cpp | |
parent | 096d0ef02b344a62f4dceea55e05d975b023b859 (diff) |
Delay showing keyboard until application is active
Android starts asking lots of questions when the software keyboard
pops up, so let's wait until the application is initialized. This
works around a deadlock on startup.
Task-number: QTBUG-41369
Change-Id: I1c79e32d08c7cc11748ec55efbff3bc25e40f4b2
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/qandroidinputcontext.cpp')
-rw-r--r-- | src/plugins/platforms/android/qandroidinputcontext.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index ca9d1e69c9..e3d488b958 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<QInputMethodQueryEvent> 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(); |