Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.11.3
-
None
Description
Step to reproduce
- Launch the attached example
- Click a single time on the first TextInput
- The virtual keyboard appears
- Press any key on the virtual keyboard
Actual result: The pressed key is not sent to the TextInput
Note: Tested on Windows 10, Windows 7 and Ubuntu (X11)
Observations
Activating QT_LOGGING_RULES=qt.virtualkeyboard=true during the scenario yields these traces:
QML debugging is enabled. Only use this in a safe environment.
QApplication: invalid style override passed, ignoring it.
qt.virtualkeyboard: InputContext::setLocale(): "fr_FR"
qt.virtualkeyboard: PlatformInputContext::setLocale(): QLocale(French, Latin, France)
qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImInputItemClipRectangle)
qt.virtualkeyboard: PlatformInputContext::setFocusObject(): QQuickWidget(0x7ffc215c4f10)
qt.virtualkeyboard: PlatformInputContext::update(): QFlags<Qt::InputMethodQuery>(ImQueryAll)
qt.virtualkeyboard: PlatformInputContext::commit()
qt.virtualkeyboard: PlatformInputContext::showInputPanel()
qt.virtualkeyboard: InputEngine::virtualKeyPress(): Qt::Key(Key_Q) "Q" QFlags<Qt::KeyboardModifiers>(ShiftModifier) false
qt.virtualkeyboard: InputEngine::virtualKeyRelease(): Qt::Key(Key_Q) "Q" QFlags<Qt::KeyboardModifiers>(ShiftModifier)
input method is not set
Wrapping the QQuickWidget, to observe the arrival of the first QInputMethodQueryEvent, we can see that the QQuickWidget has not an activeFocusItem yet, and thus cannot forward him the event.
bool WrappedQuickWidget::event(QEvent *event) { if (event->type() == QEvent::InputMethodQuery) { QInputMethodQueryEvent * imqEvent = static_cast<QInputMethodQueryEvent *>(event); if (imqEvent->queries() & Qt::ImEnabled && quickWindow()->activeFocusItem() == nullptr) { qDebug() << "No active focus item available"; } } return QQuickWidget::event(event); }