ContentLayer QML Type
Provides enumeration of content layers available in a QtQuick3D. More...
Import Statement: | import QtQuick3D |
Since: | Qt 6.11 |
Detailed Description
This class is used to represent a layer of content in a 3D scene. It can be used to manage different layers of content, such as background, foreground, or UI elements.
The ContentLayer enumeration defines the available layer flags that can be used, for example, to group scene nodes together or filter which nodes are rendered by the camera.
The predefined layer names are not necessarily descriptive enough for specific use cases, in which case you can define your own layers by aliasing the ContentLayer enumeration values. Consider a city scene where you have different layers for buildings, streets, and vehicles. You can assign each of these layers a specific flag, such as layerBuildings
, layerStreets
, and layerVehicles
by aliasing the ContentLayer enumeration values. Once the layers are defined, you can assign these flags to the nodes in the scene and have the camera filter which layers to render by setting the same layer property on the Camera.
readonly property int layerBuildings: ContentLayer.Layer1 readonly property int layerStreets: ContentLayer.Layer2 readonly property int layerVehicles: ContentLayer.Layer3 | ContentLayer.Layer4
Note: Some of the layers have special meanings:
Layer | Description |
---|---|
LayerNone | No layer assigned, used to indicate that a node does not belong to any layer and should not be rendered. |
Layer0 | The main layer, used for the primary content in the scene. Nodes are assigned to this layer by default. |
Layer1-23 | Freely assignable layers, used for grouping nodes together based on their purpose or functionality. |
Layer24 and up | Reserved layers, used for special purposes or future extensions. |
LayerAll | Indicates that a node belongs to all layers, used for nodes that should be rendered in every layer. |
Note: The layers are defined as flags, which means that you can combine multiple layers
Note: This class is not intended to be instantiated directly. Instead, it is used as a singleton in QML to access the layer flags.
See also Layers Example.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.