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

Support embedding Qt Widgets in non-widget window hierarchies

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None
    • All
    • a3bec3ad3 (dev)

    Description

      QtWidget has some fundamental issues relating to being embedded in foreign/non-widget UI hierarchies.

      We currently assume that a widget is either:

      1. Top level
        • Has Qt::Window flag
        • isWindow() returns true
        • Does not have a QWidget::parent()
        • Has windowHandle(), after being shown
      2. Child
        • Does not have Qt::Window (only Qt::Widget) flag
        • isWindow() returns false
        • Has QWidget::parent()
        • Possibly has windowHandle(), if winId() has been called

      Based on the documentation of isWindow() :

      A window is a widget that isn't visually the child of any other widget and that usually has a frame and a window title.

      An embedded child widget should fall into the second case, a child widget, ie not return true for isWindow, not have Qt::Window, etc.

      But in a lot of code paths we assume that there is then a QWidget::parent(), which there is not for an embedded child widget, causing crashes in various places.

      For now, we work around it by letting embedded widgets still have Qt::Window/isWindow(), but this causes other issues, e.g:

      • Being listed in QApplication::topLevelWidgets()
        • Which in turn prevents quit if widget is visible
      • Widgets using the child window as transient parent for popups and dialogs (since it's "top level")
        • Resulting in warnings from QWindow::setTransientParent and failure to set transient parent

      Attachments

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              vestbo Tor Arne Vestbø
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes