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

QMainWindow containing QQuickView loses focus when you click inside the QQuickView

    XMLWordPrintable

Details

    • 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

        Activity

          People

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

            Dates

              Created:
              Updated: