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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.4.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      OS X 10.9.4 git Qt 5.4
    • Commits:
      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

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

          Activity

            People

            Assignee:
            tpochep Timur Pocheptsov
            Reporter:
            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