我已通过 QGraphicsProxyWidget 将 QOpenGLWidget 添加到 QGraphicsView (不使用 setviewport):
QSurfaceFormat format= QSurfaceFormat();
format->setSamples(4); //<== widget show black screen if samples =4, 1 is ok but not antialiasing
m_glWidget->setFormat(format);
MyGraphicsProxyWidget* proxy= new MyGraphicsProxyWidget();
proxy->setWidget(m_glWidget);
//add to scene
scene->addItem(proxy);
我尝试过一些方法但不起作用:
如果样本 = 4,glwidget 将显示黑屏,但样本 = 1 可以,但不能抗锯齿。
那么如何在QGraphicsView中为QOpenGLWidget(由GraphicsproxyWidget添加)启用抗锯齿呢?
有什么帮助吗?谢谢!
将代码附加到 qapplication 初始化下的 main.cpp 中
QSurfaceFormat fmt;
fmt.setSamples(10);
QSurfaceFormat::setDefaultFormat(fmt);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)