QOpenGLWidget 更新如何不会导致paintGL 事件? [英] How can QOpenGLWidget update not result in paintGL events?
问题描述
我正在记录对 update()
和 paintGL()
的调用,但不知何故,只发生了更新.paintGL 被调用了几次,然后再也没有!这怎么可能?窗口是可见的,并且每次调用 update()
时 isVisible()
都会返回 True.
I'm logging calls to update()
and paintGL()
, but somehow, only update happens. paintGL is called a couple of times and then never again! How is this possible? The window is visible and isVisible()
returns True every time update()
is called.
具体来说,我从 QGLWidget
转换为 QOpenGLWidget
.我用对 update()
的调用替换了对 updateGL()
的调用,并用调用 setFormat()
替换了将格式传递给构造函数.我在适当的地方添加了对 makeCurrent()
的各种调用.我有什么遗漏吗?
Specifically, I converted from QGLWidget
to QOpenGLWidget
. I replaced my calls to updateGL()
with calls to update()
, and I replaced passing the format to the constructor with calling setFormat()
. I added various calls to makeCurrent()
where appropriate. Is there anything I'm missing?
当 QOpenGLWidget
是窗口中的许多小部件之一时,它似乎可能会损坏.
It appears that QOpenGLWidget
might be broken when it is one of many widgets within a window.
推荐答案
我的 QOpenGLWidget
在一个 QScrollArea
中,它没有转发 QPaint
事件.
My QOpenGLWidget
was in a QScrollArea
, which was not forwarding QPaint
events.
这篇关于QOpenGLWidget 更新如何不会导致paintGL 事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!