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

[Regression] A child QGLWidget stops repainting after window is recreated

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • None
    • 5.4.0
    • None
    • OS X 10.9.4 git Qt 5.4
    • I4cc7a6b1bd3e34741ad50c2e0d2a2add242b28e4

    Description

      • Compile and run the code below
      #include <QWidget>
      #include <QKeyEvent>
      #include <QApplication>
      class Widget : public QWidget
      {
      protected:
        void keyPressEvent(QKeyEvent* e)
        {
          if(e->key() == Qt::Key_Space)
          {
            setWindowFlags(windowFlags() ^ Qt::FramelessWindowHint);
            show();
          }
        }
      };
      
      #include <QGLWidget>
      class GLWidget : public QGLWidget
      {
      public:
        using QGLWidget::QGLWidget;
      
      protected:
        void	paintGL() override
        {
          glClearColor(1, 0, 0, 1);
          glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
        }
      };
      
      #include <QVBoxLayout>
      int main(int argc, char *argv[])
      {
        QApplication a(argc, argv);
        Widget w;
        w.setMinimumSize({100, 100});
      
        auto l = new QVBoxLayout;
        w.setLayout(l);
        l->addWidget(new GLWidget(&w));
      
        w.show();
      
        return a.exec();
      }
      
      

      A window shows up with red a square - the QGLWidget.

      • press space
        Under 5.4 QGLWidget will stop repainting and show garbage.
        Under 5.3.2 it works fine.

      Debugging shows painting bails out because Qt::WA_Mapped is no longer true.

      Attachments

        1. QTBUG-41701.tar.gz
          0.9 kB
          Timur Pocheptsov
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            mnaydenov Mihail Naydenov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes