Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.0.0, 5.1.0 , 5.2.0, 5.3.0
-
Linux, X11, XCB
Description
Since the native WinId of a QWidget might be changed at runtime, we have to handle QEvent::WinIdChange event. However, when we can handle the event, the old window might have been destroyed. If we previously use the winId() to do some platform specific operations, it's not possible to undo them for the old window before it's destruction.
For example, if in X11, you try to reparent a X native window on your widget, you'll need to unparent it again before destroying your widget. Otherwise the embedded window will be destroyed together.
(I know this can be done with QWidget::createWindowContainer, just for example).
The point is, some platform specific operations previously done on the native window might need to be undone before its destruction but we have no way to get the notification when WinId is going to be changed.
So I propose adding a QEvent::WinIdAboutToBeChanged event to QWidget.
Without this feature, it's hard to use winId() to do some platform specific tasks.
Attachments
Issue Links
- relates to
-
QTBUG-40681 [REG 4->5] When using multiple monitors and one monitor is disconnected causing the window to move then winId() is not updated
- Closed
- replaces
-
QTBUG-40791 Regression: QPlatformWindow, QWindow, and QWidget::winId() are out of sync.
- Closed
-
QTBUG-41163 using KVM Switch: Segmentation fault (core dumped)
- Closed