1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt3D module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include "qscenechange.h" |
41 | |
42 | #include "qscenechange_p.h" |
43 | |
44 | QT_BEGIN_NAMESPACE |
45 | |
46 | namespace Qt3DCore { |
47 | |
48 | /*! |
49 | * \enum Qt3DCore::ChangeFlag |
50 | * \relates Qt3DCore::QSceneChange |
51 | * \obsolete |
52 | * |
53 | * The types of change that can be sent and received by Qt3D's change notification system. |
54 | * |
55 | * \value NodeCreated A new instance of a QNode subclass has been created. |
56 | * \value NodeDeleted A QNode has been deleted. |
57 | * \value PropertyUpdated A QNode property has been updated. |
58 | * \value PropertyValueAdded A QNode has been added to the scene. |
59 | * \value PropertyValueRemoved A QNode has been removed from the scene. |
60 | * \value CommandRequested A QNodeCommand has been sent between a node and its backend. |
61 | * \value ComponentAdded A QComponent has been added to a QEntity. |
62 | * \value ComponentRemoved A QComponent has been removed from a QEntity. |
63 | * \value CallbackTriggered A QNode triggered a callback. |
64 | * \value AllChanges Allows an observer to monitor for any of the above changes. |
65 | */ |
66 | |
67 | QSceneChangePrivate::QSceneChangePrivate() |
68 | : q_ptr(nullptr) |
69 | , m_subjectId() |
70 | , m_deliveryFlags(QSceneChange::BackendNodes) |
71 | , m_type(AllChanges) |
72 | { |
73 | } |
74 | |
75 | QSceneChangePrivate::~QSceneChangePrivate() |
76 | { |
77 | } |
78 | |
79 | /*! |
80 | * \class Qt3DCore::QSceneChange |
81 | * \inheaderfile Qt3DCore/QSceneChange |
82 | * \inmodule Qt3DCore |
83 | * \brief The base class for changes that can be sent and received by Qt3D's change notification system. |
84 | */ |
85 | |
86 | /*! |
87 | * \typedef Qt3DCore::QSceneChangePtr |
88 | * \relates Qt3DCore::QSceneChange |
89 | * |
90 | * A shared pointer for QSceneChange. |
91 | */ |
92 | |
93 | /*! |
94 | * \enum QSceneChange::DeliveryFlag |
95 | * |
96 | * The types of change that can be sent and received by Qt3D's change notification system. |
97 | * |
98 | * \value BackendNodes |
99 | * \value Nodes |
100 | * \value DeliverToAll |
101 | */ |
102 | |
103 | /*! |
104 | * Constructs a new QSceneChange with \a type and \a subjectId. |
105 | */ |
106 | QSceneChange::QSceneChange(ChangeFlag type, QNodeId subjectId) |
107 | : d_ptr(new QSceneChangePrivate) |
108 | { |
109 | d_ptr->q_ptr = this; |
110 | Q_D(QSceneChange); |
111 | d->m_type = type; |
112 | d->m_subjectId = subjectId; |
113 | } |
114 | |
115 | /*! \internal */ |
116 | QSceneChange::QSceneChange(QSceneChangePrivate &dd, |
117 | ChangeFlag type, QNodeId subjectId) |
118 | : d_ptr(&dd) |
119 | { |
120 | d_ptr->q_ptr = this; |
121 | Q_D(QSceneChange); |
122 | d->m_type = type; |
123 | d->m_subjectId = subjectId; |
124 | } |
125 | |
126 | QSceneChange::~QSceneChange() |
127 | { |
128 | delete d_ptr; |
129 | } |
130 | |
131 | /*! |
132 | * Returns the scene change type. |
133 | */ |
134 | ChangeFlag QSceneChange::type() const Q_DECL_NOTHROW |
135 | { |
136 | Q_D(const QSceneChange); |
137 | return d->m_type; |
138 | } |
139 | |
140 | /*! |
141 | Sets the delivery flags of the change to \a flags. |
142 | */ |
143 | void QSceneChange::setDeliveryFlags(DeliveryFlags flags) Q_DECL_NOTHROW |
144 | { |
145 | Q_D(QSceneChange); |
146 | d->m_deliveryFlags = flags; |
147 | } |
148 | |
149 | /*! |
150 | Returns the set delivery flags. |
151 | */ |
152 | QSceneChange::DeliveryFlags QSceneChange::deliveryFlags() const Q_DECL_NOTHROW |
153 | { |
154 | Q_D(const QSceneChange); |
155 | return d->m_deliveryFlags; |
156 | } |
157 | |
158 | /*! |
159 | * \return scene change subject id. |
160 | */ |
161 | QNodeId QSceneChange::subjectId() const Q_DECL_NOTHROW |
162 | { |
163 | Q_D(const QSceneChange); |
164 | return d->m_subjectId; |
165 | } |
166 | |
167 | } // Qt3D |
168 | |
169 | QT_END_NAMESPACE |
170 | |