Details
-
Task
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
-
-
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:
- Top level
- Has Qt::Window flag
- isWindow() returns true
- Does not have a QWidget::parent()
- Has windowHandle(), after being shown
- 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
- resulted from
-
QTBUG-116189 Investigate Qt Widgets window embedding
- Closed
Gerrit Reviews
For Gerrit Dashboard: QTBUG-119652 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
522824,3 | Don't clear Qt::Window/ForeignWindow of QWidget if window is not top level | dev | qt/qtbase | Status: MERGED | +2 | 0 |