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

Add QEvent::WinIdAboutToBeChanged event to QWidget

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.0.0, 5.1.0 , 5.2.0, 5.3.0
    • QPA, QPA: X11/XCB
    • Linux, X11, XCB

      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.

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

            liaqi Liang Qi
            pcman Hong Jen Yee
            Votes:
            2 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes