QT Quick3D。 View3d不显示
我需要将此C ++项目移植到Python
The original project uses Qt3DQuickWindow which doesn't exist in python so I'm using a QQuickView
class QuickWidget:
def __init__(self):
self.app = QApplication(sys.argv)
format = QSurfaceFormat()
if QOpenGLContext.openGLModuleType() == QOpenGLContext.LibGL:
format.setVersion(3, 2)
format.setProfile(QSurfaceFormat.CoreProfile)
format.setDepthBufferSize(24)
format.setStencilBufferSize(8)
format.setSamples(4)
self.controller = SceneController()
self.controllerWidget = ControllerWidget(self.controller)
self.controllerWidget.show()
self.view = QQuickView()
self.view.setFormat(format)
self.view.setResizeMode(QQuickView.SizeRootObjectToView)
self.view.rootContext().setContextProperty("_controller", self.controller)
self.view.setSource(QUrl("main_quick.qml"))
self.view.show()
self.app.exec_()
I wrapped the main qml class
Item {
id: mainview
width: 1280
height: 768
visible: true
View3D {
anchors.fill: parent
DefaultSceneEntity {
/// code from the original project
}
}
}
我没有更改其他QML文件。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论