diff options
author | Juan Jose Casafranca <juan.casafranca@kdab.com> | 2018-02-05 11:46:31 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-02-14 09:54:46 +0000 |
commit | d360e16fdcab2197924e2505695c412bcaadbbe0 (patch) | |
tree | 9f5c527204ac54118330903dda27cfe2d2bc33dd | |
parent | f76259554244bf3fa3045e58c1f59f3eac1b6a03 (diff) |
Add private api to retrieve a vector of typed components
Change-Id: If53d29902d786c3e8369e521582aee5ab0bdcf7a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/core/nodes/qentity_p.h | 13 |
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; }; |