内容表

上一话题

Qt 3D:波形 QML 范例

下一话题

Qt 3D:线框 QML 范例

Qt 3D:带 Widget 的 Scene3D QML 范例

A QWidget -based application with a QML scene containing a 3D scene.

../_images/widgets-scene3d.png

widgets-scene3D demonstrates visualizing a 3D scene from a QWidget -based application using QQuickWidget .

The actual 3D scene is the same as in the scene3d 范例。

This approach is different from the one based on createWindowContainer() demonstrated in basicshapes-cpp because it does not create a native window for the Qt 3D content. Rather, it uses QQuickWidget , a genuine QWidget subclass to compose the Qt Quick and Qt 3D content together with the traditional widgets.

注意

Be aware of the performance implications. While this approach is very flexible in the sense that it allows mixing QML and Qt 3D with widgets without clipping or stacking issues, using Scene3D QQuickWidget involves rendering to offscreen render targets (via framebuffer objects) twice. This is not always desirable for more complex scenes. For those the native window based approach shown in basicshapes-cpp will likely be a better choice.

运行范例

要运行范例从 Qt Creator ,打开 欢迎 模式,然后选择范例从 范例 . For more information, visit Building and Running an Example.

范例工程 @ code.qt.io