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

QMainWindow containing QQuickView loses focus when you click inside the QQuickView

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.3, 6.1.2
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      macOS

      Description

      Steps to reproduce:

      1. Build and run the attached program.
      2. Select menu item Main Window > Open Second Window.
      3. Click on the blue area in the second window.
        • The menu bar changes from the second window's to the global app's.

      At least in the original application I was working with (I didn't try with the attached test application), when the focus goes wrong, the application's focus object is QQuickRootItem and the focus window is a QQuickView. When the focus is correct, the focus object is my QMainWIndow subclass and the focus window is a QWidgetWindow.

      I can avoid the problem by replacing the QQuickView and QWidget::createWindowContainer() with a QQuickWidget.

      However, will QQuickWidget continue to work? This blog post from 2014 strongly advises using QQuickWidget over QWidget::createWindowContainer(). But this bug report from 2020 recommends QWidget::createWindowContainer() and says QQuickWidget may become deprecated.

        Attachments

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

          Activity

            People

            Assignee:
            tvete Paul Olav Tvete
            Reporter:
            jaymie.strecker Jaymie Strecker
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes