Qt Virtual Keyboard fails with "input method is not set"
Roughly 50% of the times when the virtual keyboard is started, it is broken. Touching the buttons prints "input method is not set" on the terminal, instead of inserting the characters.
Upstream bug report: https://bugreports.qt.io/browse/QTBUG-80281
Here is a workaround that appeared to be working: https://forum.qt.io/post/594648 -- but after more testing, it appears that the bug just happens randomly, with the workaround applied and without it
I've also tried different workarounds, like calling .reset()
and doing the same thing as in the workaround in an interval (twice per second). It did not help.
I won't be able to fix this until releasing postmarketos-ondev 0.2.0, which I'll do later today. However, I'll try to fix this soon by digging into the qtvirtualkeyboard souce, adding debug prints and figuring out why inputMethod is not set. From qvirtualkeyboardinputengine.cpp:
bool virtualKeyClick(Qt::Key key, const QString &text, Qt::KeyboardModifiers modifiers, bool isAutoRepeat)
{
Q_Q(QVirtualKeyboardInputEngine);
bool accept = false;
if (inputMethod) {
accept = inputMethod->keyEvent(key, text, modifiers);
if (!accept) {
accept = fallbackInputMethod->keyEvent(key, text, modifiers);
}
emit q->virtualKeyClicked(key, text, modifiers, isAutoRepeat);
} else if (QT_VIRTUALKEYBOARD_FORCE_EVENTS_WITHOUT_FOCUS) {
accept = fallbackInputMethod->keyEvent(key, text, modifiers);
emit q->virtualKeyClicked(key, text, modifiers, isAutoRepeat);
} else {
qWarning() << "input method is not set";
}
return accept;
}
CC: @bshah