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.