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

Crash when Qt re-create native windows if WA_DontCreateNativeAncestors is set

    XMLWordPrintable

Details

    • 12203e94f (dev), 4f4ffa8a6 (6.7), 06a1e3b3c (6.6), fdcea763d (tqtc/lts-6.5), ed3d0ee5c (6.6.2)

    Description

      Please use the following code to reproduce

      #include <QtWidgets/QApplication>
      #include <QtWidgets/QWidget>
      #include <QtWidgets/QApplication>
      #include <QtOpenGLWidgets/QtOpenGLWidgets>
      
      int main(int argc, char** argv)
      {
          QApplication app(argc, argv);
      
          // tlw: red.
          QWidget tlw;
          tlw.resize(640, 480);
          tlw.setStyleSheet("QWidget { background-color: red; }");
      
          // alien widget: yellow.
          QWidget alien(&tlw);
          alien.setGeometry(0, 0, 640, 240);
          alien.setStyleSheet("QWidget { background-color: yellow; }");
      
          // native widget: blue.
          // the parent alien widget is still alien due to WA_DontCreateNativeAncestors flag.
          QWidget native(&alien);
          native.setAttribute(Qt::WA_DontCreateNativeAncestors);
          native.winId();
          native.setStyleSheet("QWidget { background-color: blue; }");
      
          // trigger window re-create by inserting a QOpenGLWidget.
          QOpenGLWidget* gl = new QOpenGLWidget(&native);
          gl->setGeometry(0, 0, 50, 50);
      
          tlw.show();
          return app.exec();
      } 

      Attachments

        Issue Links

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

          Activity

            People

              vestbo Tor Arne Vestbø
              mingxiang Mingxiang Xu
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: