summaryrefslogtreecommitdiffstats
path: root/src/core/nodes/qcomponent.cpp
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2015-08-17 10:21:56 +0200
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-08-17 10:22:07 +0200
commit2c4f13290cb9f96184d386c8a3a525569359f553 (patch)
tree89424c7992fee950eb0c06404729d4cbcd12f027 /src/core/nodes/qcomponent.cpp
parentb6c0e90171fcddbd71bbdb84aca0b2c0b87149ef (diff)
parente8df467c8d15a203bffaee858dbb93507700eb61 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Diffstat (limited to 'src/core/nodes/qcomponent.cpp')
-rw-r--r--src/core/nodes/qcomponent.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp
index 71acb6a03..60817ac5a 100644
--- a/src/core/nodes/qcomponent.cpp
+++ b/src/core/nodes/qcomponent.cpp
@@ -38,7 +38,7 @@
#include "qcomponent_p.h"
#include "qentity.h"
#include "qentity_p.h"
-#include "qsceneinterface.h"
+#include "qscene_p.h"
#include <Qt3DCore/qscenepropertychange.h>
QT_BEGIN_NAMESPACE
@@ -60,7 +60,7 @@ void QComponentPrivate::addEntity(QEntity *entity)
{
m_entities.append(entity);
- if (m_scene != Q_NULLPTR) {
+ if (m_scene != Q_NULLPTR && !m_scene->hasEntityForComponent(m_id, entity->id())) {
if (!m_shareable && !m_scene->entitiesForComponent(m_id).isEmpty())
qWarning() << "Trying to assign a non shareable component to more than one Entity";
m_scene->addEntityForComponent(m_id, entity->id());
@@ -128,7 +128,7 @@ QComponent::~QComponent()
Q_ASSERT_X(QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3D::QComponent subclass didn't call QNode::cleanup in its destructor");
Q_FOREACH (QEntity *entity, entities()) {
- QEntityPrivate *entityPimpl = dynamic_cast<QEntityPrivate *>(QEntityPrivate::get(entity));
+ QEntityPrivate *entityPimpl = static_cast<QEntityPrivate *>(QEntityPrivate::get(entity));
if (entityPimpl)
entityPimpl->m_components.removeAll(this);
}