1 | // Copyright (C) 2020 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 "coresettings_p.h" |
5 | #include <Qt3DCore/private/qcoreaspect_p.h> |
6 | |
7 | QT_BEGIN_NAMESPACE |
8 | |
9 | namespace Qt3DCore { |
10 | |
11 | CoreSettings::CoreSettings() |
12 | : QBackendNode() |
13 | { |
14 | } |
15 | |
16 | void CoreSettings::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) |
17 | { |
18 | Q_UNUSED(firstTime); |
19 | |
20 | const QCoreSettings *node = qobject_cast<const QCoreSettings *>(object: frontEnd); |
21 | if (!node) |
22 | return; |
23 | |
24 | Q_ASSERT(m_aspect); |
25 | auto daspect = QCoreAspectPrivate::get(aspect: m_aspect); |
26 | daspect->m_boundingVolumesEnabled = node->boundingVolumesEnabled(); |
27 | } |
28 | |
29 | CoreSettingsFunctor::CoreSettingsFunctor(QCoreAspect *aspect) |
30 | : m_aspect(aspect) |
31 | , m_settings(nullptr) |
32 | { |
33 | } |
34 | |
35 | Qt3DCore::QBackendNode *CoreSettingsFunctor::create(Qt3DCore::QNodeId) const |
36 | { |
37 | if (m_settings != nullptr) { |
38 | qWarning() << "Core settings already exists"; |
39 | return nullptr; |
40 | } |
41 | |
42 | m_settings = new CoreSettings; |
43 | m_settings->setAspect(m_aspect); |
44 | return m_settings; |
45 | } |
46 | |
47 | Qt3DCore::QBackendNode *CoreSettingsFunctor::get(Qt3DCore::QNodeId id) const |
48 | { |
49 | Q_UNUSED(id); |
50 | return m_settings; |
51 | } |
52 | |
53 | void CoreSettingsFunctor::destroy(Qt3DCore::QNodeId id) const |
54 | { |
55 | Q_UNUSED(id); |
56 | delete m_settings; |
57 | m_settings = nullptr; |
58 | } |
59 | |
60 | } // namespace Qt3DCore |
61 | |
62 | QT_END_NAMESPACE |
63 |