1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "layer_p.h"
5#include <Qt3DRender/qlayer.h>
6#include <Qt3DRender/private/qlayer_p.h>
7#include <Qt3DRender/private/stringtoint_p.h>
8#include <QVariant>
9
10QT_BEGIN_NAMESPACE
11
12using namespace Qt3DCore;
13
14namespace Qt3DRender {
15namespace Render {
16
17Layer::Layer()
18 : BackendNode()
19 , m_recursive(false)
20{
21}
22
23Layer::~Layer()
24{
25 cleanup();
26}
27
28void Layer::cleanup()
29{
30 QBackendNode::setEnabled(false);
31}
32
33void Layer::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
34{
35 const QLayer *node = qobject_cast<const QLayer *>(object: frontEnd);
36 if (!node)
37 return;
38
39 const bool oldEnabled = isEnabled();
40 BackendNode::syncFromFrontEnd(frontEnd, firstTime);
41
42 if (isEnabled() != oldEnabled || firstTime)
43 markDirty(changes: AbstractRenderer::LayersDirty);
44
45 if (node->recursive() != m_recursive) {
46 m_recursive = node->recursive();
47 markDirty(changes: AbstractRenderer::LayersDirty);
48 }
49}
50
51bool Layer::recursive() const
52{
53 return m_recursive;
54}
55
56void Layer::setRecursive(bool recursive)
57{
58 m_recursive = recursive;
59}
60
61} // namespace Render
62} // namespace Qt3DRender
63
64QT_END_NAMESPACE
65

source code of qt3d/src/render/backend/layer.cpp