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
.我将对updateGL()
的调用替换为对update()
的调用,并将替换格式通过调用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屋!