summaryrefslogtreecommitdiffstats
path: root/src/quick3d/quick3d/items/quick3dentity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick3d/quick3d/items/quick3dentity.cpp')
-rw-r--r--src/quick3d/quick3d/items/quick3dentity.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/quick3d/quick3d/items/quick3dentity.cpp b/src/quick3d/quick3d/items/quick3dentity.cpp
index ebc92e843..c2814a79e 100644
--- a/src/quick3d/quick3d/items/quick3dentity.cpp
+++ b/src/quick3d/quick3d/items/quick3dentity.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "quick3dentity_p.h"
+
#include <Qt3DCore/qcomponent.h>
QT_BEGIN_NAMESPACE
@@ -92,6 +93,7 @@ void Quick3DEntity::qmlAppendComponent(QQmlListProperty<QComponent> *list, QComp
if (comp == nullptr)
return;
Quick3DEntity *self = static_cast<Quick3DEntity *>(list->object);
+ self->m_managedComponents.push_back(comp);
self->parentEntity()->addComponent(comp);
}
@@ -110,10 +112,9 @@ int Quick3DEntity::qmlComponentsCount(QQmlListProperty<QComponent> *list)
void Quick3DEntity::qmlClearComponents(QQmlListProperty<QComponent> *list)
{
Quick3DEntity *self = static_cast<Quick3DEntity *>(list->object);
- const QComponentVector components = self->parentEntity()->components();
- for (QComponent *comp : components) {
+ for (QComponent *comp : qAsConst(self->m_managedComponents))
self->parentEntity()->removeComponent(comp);
- }
+ self->m_managedComponents.clear();
}
} // namespace Quick