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

Visibility of embedded QQuickWindow contentItem broken with Qt 6.5

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 6.5
    • GUI: Window management
    • None
    • macOS

    Description

      In our macOS applications we embed QQuickWindows into our application's main NSView. One such window is embedded before being shown - it is shown later in the application lifetime.

      In Qt 6.5 the `QQuickItemPrivate::calcEffectiveVisible` function changed from

      
      bool QQuickItemPrivate::calcEffectiveVisible() const
      {
          // XXX todo - Should the effective visible of an element with no parent just be the current
          // effective visible?  This would prevent pointless re-processing in the case of an element
          // moving to/from a no-parent situation, but it is different from what graphics view does.
          return explicitVisible && (!parentItem || QQuickItemPrivate::get(parentItem)->effectiveVisible);
      }
      

      into:

      
      bool QQuickItemPrivate::calcEffectiveVisible() const
      {
      // An item is visible if it is a child of a visible parent, and not explicitly hidden.
          return explicitVisible && parentItem && QQuickItemPrivate::get(parentItem)->effectiveVisible;
      }
      
      

      With this change, when we call show on our initially hidden embedded QQuickWindow , the content item never changes its visibility to `true` - it simply remains false. We can work around this issue by including private headers and doing the following:

      QObject::connect(window, &QQuickWindow::visibleChanged, [window]() {
      if (window->isVisible())
      {
      QQuickItemPrivate::get(window->contentItem())->setEffectiveVisibleRecur(true);
      }
      });
      
      

      However, this is obviously not ideal. I would expect a such a call to `setEffectiveVisibleRecur(true)` to be made on the window's content item on `QQuickWindow::show`. Could it be that this was missed out in the refactor of `calcEffectiveVisible` ?

      Thanks.

      Attachments

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

        Activity

          People

            vestbo Tor Arne Vestbø
            leadbelly Ben Leadbetter
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes