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

Provide a way to check whether QOpenGLWidget will actually call paintGL() after an update()

    XMLWordPrintable

Details

    Description

      There is no currently no way to know if calling update() on a QOpenGLWidget will trigger a call to paintGL(). Having an attribute that tells QOpenGLWidget to unconditionally call paintGL would be ideal.

      In my particular case I'm using libmpv and rendering video to QOpenGLWidget. I have to guess whether paintGL will be called or not and handle the two cases differently. This is not robust at all because there may be some other reason that prevents updates.

      My (unreliable) code looks like:

      QWidget *w = window();
      if (!w->updatesEnabled() || w->isHidden() || w->isMinimized() || isHidden() ||        !updatesEnabled()) {
          makeCurrent();
          paintGL();
          QOpenGLContext *c = context();
          c->swapBuffers(c->surface());
          doneCurrent();
      } else update();

       

       

      Attachments

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

        Activity

          People

            lagocs Laszlo Agocs
            flaviotordini Flavio Tordini
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes