QOpenGLWidget更新如何不会导致paintGL事件? [英] How can QOpenGLWidget update not result in paintGL events?

查看:867
本文介绍了QOpenGLWidget更新如何不会导致paintGL事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在记录对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.

推荐答案

我的QOpenGLWidgetQScrollArea中,它没有转发QPaint事件.

My QOpenGLWidget was in a QScrollArea, which was not forwarding QPaint events.

这篇关于QOpenGLWidget更新如何不会导致paintGL事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆