QWidget::createWindowContainer() can create a QWindowContainer object which embed a native window to an existing QWidget.
However, according to the design, the native WId of the parent widget may be changed at runtime. So when this happen, QWindowContainer should reparent the embedded native window automatically otherwise things will be broken.
This does not work with the XCB backend which uses XEMBED.
Please note that it's not possible for application developers to handle this ourselves since when QEvent::WinIdChange happen, the old window is already destroyed and we have no chance to unparent the embedded window before that.