diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2018-02-15 12:44:27 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2018-02-15 20:59:03 +0000 |
commit | 6e82860f19bb28744c0d7f6ccc88ca89b187e3ce (patch) | |
tree | 1c8682d5bf06a0a03cefc3da5e3918056de78a04 /src/core/nodes | |
parent | 0bbccd492532786adc6816b992b85b4fdf162842 (diff) | |
parent | e1d1a59eb04f8b17582571275073a6cfa10e9e32 (diff) |
Merge remote-tracking branch 'origin/5.10' into 5.11
Conflicts:
src/animation/doc/src/qt3danimation-module.qdoc
src/render/backend/abstractrenderer_p.h
src/render/backend/buffervisitor_p.h
src/render/backend/renderer.cpp
src/render/backend/renderer_p.h
src/render/backend/triangleboundingvolume_p.h
src/render/backend/trianglesextractor_p.h
src/render/frontend/sphere_p.h
src/render/jobs/calcboundingvolumejob.cpp
src/render/jobs/job_common_p.h
src/render/jobs/pickboundingvolumejob.cpp
src/render/jobs/pickboundingvolumejob_p.h
src/render/jobs/pickboundingvolumeutils.cpp
src/render/jobs/renderviewjobutils_p.h
tests/auto/render/boundingsphere/tst_boundingsphere.cpp
tests/auto/render/commons/testrenderer.h
tests/auto/render/raycasting/tst_raycasting.cpp
tests/auto/render/render.pro
tests/auto/render/renderer/tst_renderer.cpp
Change-Id: I76633bc5a5a065e5f9ea62cc16563377e5c693a3
Diffstat (limited to 'src/core/nodes')
-rw-r--r-- | src/core/nodes/qcomponent.cpp | 4 | ||||
-rw-r--r-- | src/core/nodes/qnode.cpp | 47 |
2 files changed, 33 insertions, 18 deletions
diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp index 8e337adf6..f4e59e058 100644 --- a/src/core/nodes/qcomponent.cpp +++ b/src/core/nodes/qcomponent.cpp @@ -73,7 +73,7 @@ void QComponentPrivate::addEntity(QEntity *entity) m_scene->addEntityForComponent(m_id, entity->id()); } - const auto componentAddedChange = QComponentAddedChangePtr::create(entity, q); + const auto componentAddedChange = QComponentAddedChangePtr::create(q, entity); notifyObservers(componentAddedChange); Q_EMIT q->addedToEntity(entity); } @@ -86,7 +86,7 @@ void QComponentPrivate::removeEntity(QEntity *entity) m_entities.removeAll(entity); - const auto componentRemovedChange = QComponentRemovedChangePtr::create(entity, q); + const auto componentRemovedChange = QComponentRemovedChangePtr::create(q, entity); notifyObservers(componentRemovedChange); Q_EMIT q->removedFromEntity(entity); } diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp index e5a3aca71..083fda7df 100644 --- a/src/core/nodes/qnode.cpp +++ b/src/core/nodes/qnode.cpp @@ -388,28 +388,43 @@ void QNodePrivate::propertyChanged(int propertyIndex) if (m_blockNotifications) return; + const auto toBackendValue = [this](const QVariant &data) -> QVariant + { + if (data.canConvert<QNode*>()) { + QNode *node = data.value<QNode*>(); + + // Ensure the node has issued a node creation change. We can end + // up here if a newly created node with a parent is immediately set + // as a property on another node. In this case the deferred call to + // _q_postConstructorInit() will not have happened yet as the event + // loop will still be blocked. So force it here and we catch this + // eventuality in the _q_postConstructorInit() function so that we + // do not repeat the creation and new child scene change events. + if (node) + QNodePrivate::get(node)->_q_postConstructorInit(); + + const QNodeId id = node ? node->id() : QNodeId(); + return QVariant::fromValue(id); + } + + return data; + }; + Q_Q(QNode); const QMetaProperty property = q->metaObject()->property(propertyIndex); const QVariant data = property.read(q); - if (data.canConvert<QNode*>()) { - QNode *node = data.value<QNode*>(); - - // Ensure the node has issued a node creation change. We can end - // up here if a newly created node with a parent is immediately set - // as a property on another node. In this case the deferred call to - // _q_postConstructorInit() will not have happened yet as the event - // loop will still be blocked. So force it here and we catch this - // eventuality in the _q_postConstructorInit() function so that we - // do not repeat the creation and new child scene change events. - if (node) - QNodePrivate::get(node)->_q_postConstructorInit(); - - const QNodeId id = node ? node->id() : QNodeId(); - notifyPropertyChange(property.name(), QVariant::fromValue(id)); + + if (data.type() == QVariant::List) { + QSequentialIterable iterable = data.value<QSequentialIterable>(); + QVariantList variants; + variants.reserve(iterable.size()); + for (const auto &v : iterable) + variants.append(toBackendValue(v)); + notifyPropertyChange(property.name(), variants); } else { - notifyPropertyChange(property.name(), data); + notifyPropertyChange(property.name(), toBackendValue(data)); } } |