Qt 3D Studio Runtime: Layers in Qt Quick Example

Demonstrates using the View3D element in a Qt Quick application.

This example demonstrates basic usage of the View3D element in Qt Quick applications

Running the Example

To run the example from Qt Creator, open the Welcome mode and select the example from Examples. For more information, visit Building and Running an Example.


This example consists of a simple C++ main() function that sets up a QQuickView and a QML scene demonstrating the usage of the Studio3D and View3D QML types. This combination is important because once a View3D element is added to the Qt Quick scene, the behavior of Studio3D changes significantly: instead of displaying the composited image of all layers from the Qt 3D Studio presentation loaded from the .uip file(s), it rather delegates the rendering of the individual layers to the View3D items.

This offers a lightweight and efficient way to create user interfaces that have 3D content present in a number of different areas in the window. In contrast, the traditional approach treats the 3D view as a "box", a rectangular area defined by the bounds of the Studio3D element. With View3D this limitation can be lifted since each layer from the 3D scene can be managed (positioned, transformed, blended) individually via a View3D instance dedicated to that layer.

In the example the source .uip file has two layers. Both have transparent backgrounds, one contains a single cube, while the other a sphere and some text nodes. When it comes to the Studio3D item, the QML code is no different from other examples. What makes it special is the inclusion of two View3D items, each referencing a layer from the .uip presentation by name.


Available under certain Qt licenses.
Find out more.