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 | #ifndef QT3DCORE_QENTITY_P_H |
5 | #define QT3DCORE_QENTITY_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of other Qt classes. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <Qt3DCore/qentity.h> |
19 | |
20 | #include <Qt3DCore/private/qnode_p.h> |
21 | #include <Qt3DCore/private/qt3dcore_global_p.h> |
22 | #include <Qt3DCore/private/qchangearbiter_p.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | namespace Qt3DCore { |
27 | |
28 | class Q_3DCORE_PRIVATE_EXPORT QEntityPrivate : public QNodePrivate |
29 | { |
30 | public : |
31 | QEntityPrivate(); |
32 | ~QEntityPrivate(); |
33 | |
34 | Q_DECLARE_PUBLIC(QEntity) |
35 | static QEntityPrivate *get(QEntity *q); |
36 | |
37 | QNodeId parentEntityId() const; |
38 | void updateComponentRelationShip(QComponent *component, ComponentRelationshipChange::RelationShip change); |
39 | |
40 | template<class T> |
41 | QList<T*> componentsOfType() const |
42 | { |
43 | QList<T*> typedComponents; |
44 | for (QComponent *comp : m_components) { |
45 | T *typedComponent = qobject_cast<T*>(comp); |
46 | if (typedComponent != nullptr) |
47 | typedComponents.append(typedComponent); |
48 | } |
49 | return typedComponents; |
50 | } |
51 | |
52 | QString dumpSceneGraph() const; |
53 | void removeDestroyedComponent(QComponent *comp); |
54 | |
55 | QComponentVector m_components; |
56 | mutable QNodeId m_parentEntityId; |
57 | bool m_dirty; |
58 | }; |
59 | |
60 | } |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #endif // QT3DCORE_QENTITY_P_H |
65 | |