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

Add QEvent::WinIdAboutToBeChanged event to QWidget

    XMLWordPrintable

    Details

    • Type: Suggestion
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.0.0, 5.1.0 , 5.2.0, 5.3.0
    • Fix Version/s: None
    • Component/s: QPA, QPA: X11/XCB
    • Labels:
    • Environment:

      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

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

            Activity

              People

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

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes