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

QQuickWidget doesn't set active focus on Linux in some cases

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6, 5.7, 5.8, 5.9.3, 5.10.0, 5.9
    • Quick: Widget
    • None
    • Linux 64bit

    Description

      The attached example shows the use-case: QQuickWidget loads a QML with an input field. On the top a QLineEdit waits for input. When pressing enter in the QLineEdit it is expected to forward the keyboard focus to the QQuickWidget's input field. This mimics the behavior of an url bar and a web view.

      When a QCompleter is set on the QLineEdit and the completer matches, a popup is shown which makes the QQuickWidget's window inactive and blocks forceActiveFocus on the QQuickWidget content when pressing enter.

      Steps to reproduce:

      1. Build and start the attached example
      2. Start type "te" (word "test" is hardcoded in the example)
      3. Press Enter
      4. Start typing again

      Expected behavior
      Keyboard focus is on the QQuickWidget's input field and the typed text appears in it

      Actual behavior
      No focus, no text appearing

      This was originally a webengine issue: https://bugreports.qt.io/browse/QTBUG-56652

      The corresponding workaround is in this is example too (guarded with #if 0). Enabling it makes the focus work. However this workaround raised yet another issue: https://bugreports.qt.io/browse/QTBUG-59080

      I would expect the focus is passed without any workaround in the described case.

      I tested this on Windows and Mac OS too. On other platforms than Linux everything works as expected.

      Attachments

        1. main.cpp
          2 kB
          Peter Varga
        2. test.qml
          0.7 kB
          Peter Varga

        Issue Links

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

          Activity

            People

              tvete Paul Olav Tvete
              pvarga Peter Varga
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes