Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-78492

QQuickWidget does not work with virtual keyboard input method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.11.3
    • None
    • Linux/X11, Windows

      Step to reproduce

      1. Launch the attached example
      2. Click a single time on the first TextInput
      3. The virtual keyboard appears
      4. 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);
      }
      

       

       

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            tvete Paul Olav Tvete
            jbhubert Jean-Benoît Hubert
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes