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

[regression 5.9.8 - > 5.11.x] QWidget loosing content when using winId() in embedded QWidget

XMLWordPrintable

    • Linux/X11, macOS, Windows
    • 51300566ffe2ece2455e1d0479a556c5dbb3bb8e (qt/qtbase/dev)

      A QWidget looses its visual representation after re-opening a window containing that Widget when this widget calls `winId()`

      I tested this on windows (5.12.4, 5.12.5) and macos (5.11.3, 5.12.2, 5.12.5, 5.13.1). This problem does not appear in 5.9.8, this may occur on other platforms as well.
      Versions between 5.9.8 and 5.11.3 were not tested.

      I boiled this problem down to setting attribute `Qt::WA_NativeWindow` on the widget.
      Setting this attribute causes this problem as well as calling `winId()` does, which might set this attribute as well.

      As the code for `QWidget::winId()` and `QWidgetPrivate::createWinId()` of 5.9.8 and 5.12.5 is identical it must be related to other effects of this attribute.

      Please see attached example and try:
      1) run application and press button "Show"
      2) a widget opens with a button "Button" inside
      3) close the window
      4) press button "Show" again
      5) the widget shows empty

      This problem does not occur, if one hides the widget with `QWidget::hide()`.

      it seems these bugreports are related:
      QTBUG-30181, QTBUG-57089

        For Gerrit Dashboard: QTBUG-79012
        # Subject Branch Project Status CR V

            vhilshei Volker Hilsheimer
            i.n.g.o. Ingo Randolf
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes