Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
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();