Nesta página

Qt3DRender::QLayer Class

class Qt3DRender::QLayer

A classe QLayer oferece uma maneira de filtrar quais entidades serão renderizadas. Saiba mais...

Cabeçalho: #include <qlayer.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
No QML: Layer
Herdado de: Qt3DCore::QComponent
Status: Obsoleta

Esta classe está obsoleta. Recomendamos enfaticamente que não seja usada em código novo.

Propriedades

Funções públicas

QLayer(Qt3DCore::QNode *parent = nullptr)
bool recursive() const
void setRecursive(bool recursive)

Sinais

Descrição detalhada

Qt3DRender::QLayer funciona em conjunto com a função ` Qt3DRender::QLayerFilter ` no `FrameGraph`.

Um QLayer pode ser aplicado a uma subárvore de entidades definindo-se a propriedade recursive como 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->setRecursive(true);
renderableEntity->addComponent(geometryRenderer);
renderableEntity->addComponent(layer1);

...

// FrameGraph
Qt3DRender::QViewport *viewport = new Qt3DRender::QViewport;
Qt3DRender::QLayerFilter *layerFilter = new Qt3DRender::QLayerFilter(viewport);
layerFilter->addLayer(layer1);

...

Veja também Qt3DRender::QLayerFilter.

Documentação da propriedade

recursive : bool

Especifica se a camada também é aplicada à subárvore da entidade.

Funções de acesso:

bool recursive() const
void setRecursive(bool recursive)

Sinal do notificador:

void recursiveChanged()

Documentação da função membro

[explicit] QLayer::QLayer(Qt3DCore::QNode *parent = nullptr)

Cria uma nova instância de `QLayer` com o ` parent` especificado.

© 2026 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.