QLayer Class▲
-
Header: QLayer
-
Since: Qt 5.5
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
-
qmake: QT += 3drender
-
Inherited By:
-
Instantiated By: qml-qt3d-render-layer.xml
-
Inherits: Qt3DCore::QComponent
Detailed Description▲
Qt3DRender::QLayer works in conjunction with the Qt3DRender::QLayerFilter in the FrameGraph.
A QLayer can be applied to a subtree of entities by setting the recursive property to true.
#include <Qt3DCore/QEntity>
#include <Qt3DRender/QGeometryRenderer>
#include <Qt3DRender/QLayer>
#include <Qt3DRender/QLayerFilter>
#include <Qt3DRender/QViewport>
// Scene
Qt3DCore::
QEntity *
rootEntity =
new
Qt3DCore::Qt3DCore::
QEntity;
Qt3DCore::
QEntity *
renderableEntity =
new
Qt3DCore::Qt3DCore::
QEntity(rootEntity);
Qt3DRender::
QGeometryRenderer *
geometryRenderer =
new
Qt3DCore::
QGeometryRenderer(renderableEntity);
Qt3DRender::
QLayer *
layer1 =
new
Qt3DCore::
QLayer(renderableEntity);
layer1-&
gt;setRecursive(true
);
renderableEntity-&
gt;addComponent(geometryRenderer);
renderableEntity-&
gt;addComponent(layer1);
...
// FrameGraph
Qt3DRender::
QViewport *
viewport =
new
Qt3DRender::
QViewport;
Qt3DRender::
QLayerFilter *
layerFilter =
new
Qt3DRender::
QLayerFilter(viewport);
layerFilter-&
gt;addLayer(layer1);
...
See Also▲
See also Qt3DRender::QLayerFilter
Property Documentation▲
recursive : bool▲
Specifies if the layer is also applied to the entity subtree.
Access functions:
-
bool recursive() const
-
void setRecursive(bool recursive)
Notifier signal:
-
void recursiveChanged()