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>
This commit is contained in:
parent
096d0ef02b
commit
1faba97683
@ -519,6 +519,10 @@ bool QAndroidInputContext::isAnimating() const
|
|||||||
|
|
||||||
void QAndroidInputContext::showInputPanel()
|
void QAndroidInputContext::showInputPanel()
|
||||||
{
|
{
|
||||||
|
if (QGuiApplication::applicationState() != Qt::ApplicationActive) {
|
||||||
|
connect(qGuiApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(showInputPanelLater(Qt::ApplicationState)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe();
|
QSharedPointer<QInputMethodQueryEvent> query = focusObjectInputMethodQueryThreadSafe();
|
||||||
if (query.isNull())
|
if (query.isNull())
|
||||||
return;
|
return;
|
||||||
@ -541,6 +545,14 @@ void QAndroidInputContext::showInputPanel()
|
|||||||
query->value(Qt::ImHints).toUInt());
|
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()
|
void QAndroidInputContext::hideInputPanel()
|
||||||
{
|
{
|
||||||
QtAndroidInput::hideSoftwareKeyboard();
|
QtAndroidInput::hideSoftwareKeyboard();
|
||||||
|
@ -112,6 +112,9 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void updateCursorPosition();
|
void updateCursorPosition();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void showInputPanelLater(Qt::ApplicationState);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void sendInputMethodEventThreadSafe(QInputMethodEvent *event);
|
void sendInputMethodEventThreadSafe(QInputMethodEvent *event);
|
||||||
Q_INVOKABLE void sendInputMethodEventUnsafe(QInputMethodEvent *event);
|
Q_INVOKABLE void sendInputMethodEventUnsafe(QInputMethodEvent *event);
|
||||||
|
Loading…
Reference in New Issue
Block a user