summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/nodes/qentity_p.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/nodes/qentity_p.h b/src/core/nodes/qentity_p.h
index 9e9dbbd24..ef35d83a1 100644
--- a/src/core/nodes/qentity_p.h
+++ b/src/core/nodes/qentity_p.h
@@ -70,6 +70,19 @@ public :
QNodeId parentEntityId() const;
+ template<class T>
+ QVector<T*> componentsOfType() const
+ {
+ QVector<T*> typedComponents;
+ for (QComponent *comp : m_components) {
+ T *typedComponent = qobject_cast<T*>(comp);
+ if (typedComponent != nullptr)
+ typedComponents.append(typedComponent);
+ }
+ return typedComponents;
+ }
+
+
QComponentVector m_components;
mutable QNodeId m_parentEntityId;
};