summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2016-04-19 17:16:52 +0100
committerPaul Lemire <paul.lemire@kdab.com>2016-04-29 16:22:24 +0000
commit948d0357850918596b56f38a6dc6e25cd186f5a0 (patch)
tree2a522442757660b6eadecd3a6decde1f34ab5740
parentae5ac1128bc61176f797f6e248d18b9ced051ad9 (diff)
Strip out cloning subsystem
Change-Id: I4def54a11de0f9c676ef6b2d7bd8e723ded25ab9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/core/nodes/qcomponent.cpp11
-rw-r--r--src/core/nodes/qcomponent.h1
-rw-r--r--src/core/nodes/qentity.cpp21
-rw-r--r--src/core/nodes/qentity.h3
-rw-r--r--src/core/nodes/qnode.cpp207
-rw-r--r--src/core/nodes/qnode.h27
-rw-r--r--src/core/nodes/qnode_p.h2
-rw-r--r--src/core/nodes/qnodecreatedchangegenerator_p.h2
-rw-r--r--src/core/transforms/qtransform.cpp14
-rw-r--r--src/core/transforms/qtransform.h2
-rw-r--r--src/input/frontend/qabstractphysicaldevice.cpp17
-rw-r--r--src/input/frontend/qabstractphysicaldevice.h2
-rw-r--r--src/input/frontend/qaction.cpp8
-rw-r--r--src/input/frontend/qaction.h2
-rw-r--r--src/input/frontend/qactioninput.cpp8
-rw-r--r--src/input/frontend/qactioninput.h4
-rw-r--r--src/input/frontend/qaxis.cpp9
-rw-r--r--src/input/frontend/qaxis.h2
-rw-r--r--src/input/frontend/qaxisinput.cpp10
-rw-r--r--src/input/frontend/qaxisinput.h4
-rw-r--r--src/input/frontend/qaxissetting.cpp9
-rw-r--r--src/input/frontend/qaxissetting.h4
-rw-r--r--src/input/frontend/qgenericinputdevice_p.h3
-rw-r--r--src/input/frontend/qinputchord.cpp9
-rw-r--r--src/input/frontend/qinputchord.h4
-rw-r--r--src/input/frontend/qinputsequence.cpp8
-rw-r--r--src/input/frontend/qinputsequence.h4
-rw-r--r--src/input/frontend/qinputsettings.h1
-rw-r--r--src/input/frontend/qkeyboarddevice.h1
-rw-r--r--src/input/frontend/qkeyboardhandler.cpp11
-rw-r--r--src/input/frontend/qkeyboardhandler.h2
-rw-r--r--src/input/frontend/qlogicaldevice.cpp10
-rw-r--r--src/input/frontend/qlogicaldevice.h4
-rw-r--r--src/input/frontend/qmousedevice.cpp7
-rw-r--r--src/input/frontend/qmousedevice.h2
-rw-r--r--src/input/frontend/qmousehandler.cpp14
-rw-r--r--src/input/frontend/qmousehandler.h2
-rw-r--r--src/logic/qframeaction.h2
-rw-r--r--src/plugins/sceneparsers/assimp/assimpparser.cpp1
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader.cpp9
-rw-r--r--src/quick3d/quick3d/items/quick3dentityloader_p.h4
-rw-r--r--src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp31
-rw-r--r--src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h4
-rw-r--r--src/quick3d/quick3drender/items/quick3dparameter_p.h1
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdata_p.h3
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp15
-rw-r--r--src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h4
-rw-r--r--src/render/framegraph/qcameraselector.cpp11
-rw-r--r--src/render/framegraph/qcameraselector.h2
-rw-r--r--src/render/framegraph/qclearbuffers.cpp10
-rw-r--r--src/render/framegraph/qclearbuffers.h2
-rw-r--r--src/render/framegraph/qdispatchcompute.cpp9
-rw-r--r--src/render/framegraph/qdispatchcompute.h5
-rw-r--r--src/render/framegraph/qframegraphnode.cpp5
-rw-r--r--src/render/framegraph/qframegraphnode.h1
-rw-r--r--src/render/framegraph/qfrustumculling.h3
-rw-r--r--src/render/framegraph/qlayerfilter.cpp11
-rw-r--r--src/render/framegraph/qlayerfilter.h2
-rw-r--r--src/render/framegraph/qnodraw.h3
-rw-r--r--src/render/framegraph/qrenderpassfilter.cpp10
-rw-r--r--src/render/framegraph/qrenderpassfilter.h2
-rw-r--r--src/render/framegraph/qrenderstateset.cpp14
-rw-r--r--src/render/framegraph/qrenderstateset.h2
-rw-r--r--src/render/framegraph/qrendersurfaceselector.cpp12
-rw-r--r--src/render/framegraph/qrendersurfaceselector.h2
-rw-r--r--src/render/framegraph/qrendertargetselector.cpp11
-rw-r--r--src/render/framegraph/qrendertargetselector.h2
-rw-r--r--src/render/framegraph/qsortcriterion.cpp7
-rw-r--r--src/render/framegraph/qsortcriterion.h2
-rw-r--r--src/render/framegraph/qsortpolicy.cpp17
-rw-r--r--src/render/framegraph/qsortpolicy.h3
-rw-r--r--src/render/framegraph/qsortpolicy_p.h6
-rw-r--r--src/render/framegraph/qtechniquefilter.cpp11
-rw-r--r--src/render/framegraph/qtechniquefilter.h2
-rw-r--r--src/render/framegraph/qviewport.cpp7
-rw-r--r--src/render/framegraph/qviewport.h2
-rw-r--r--src/render/framegraph/sortpolicy.cpp8
-rw-r--r--src/render/framegraph/sortpolicy_p.h2
-rw-r--r--src/render/frontend/qboundingvolumedebug.cpp7
-rw-r--r--src/render/frontend/qboundingvolumedebug_p.h4
-rw-r--r--src/render/frontend/qcamera.h1
-rw-r--r--src/render/frontend/qcameralens.cpp16
-rw-r--r--src/render/frontend/qcameralens.h2
-rw-r--r--src/render/frontend/qcomputecommand.cpp9
-rw-r--r--src/render/frontend/qcomputecommand.h6
-rw-r--r--src/render/frontend/qlayer.cpp11
-rw-r--r--src/render/frontend/qlayer.h2
-rw-r--r--src/render/frontend/qpickingsettings.cpp8
-rw-r--r--src/render/frontend/qpickingsettings.h4
-rw-r--r--src/render/frontend/qrendersettings.cpp9
-rw-r--r--src/render/frontend/qrendersettings.h2
-rw-r--r--src/render/frontend/qrendertarget.cpp8
-rw-r--r--src/render/frontend/qrendertarget.h2
-rw-r--r--src/render/frontend/qrendertargetoutput.cpp8
-rw-r--r--src/render/frontend/qrendertargetoutput.h2
-rw-r--r--src/render/geometry/qattribute.cpp19
-rw-r--r--src/render/geometry/qattribute.h4
-rw-r--r--src/render/geometry/qbuffer.cpp14
-rw-r--r--src/render/geometry/qbuffer.h2
-rw-r--r--src/render/geometry/qgeometry.cpp14
-rw-r--r--src/render/geometry/qgeometry.h2
-rw-r--r--src/render/geometry/qgeometryrenderer.cpp40
-rw-r--r--src/render/geometry/qgeometryrenderer.h2
-rw-r--r--src/render/io/qsceneloader.cpp7
-rw-r--r--src/render/io/qsceneloader.h2
-rw-r--r--src/render/lights/qabstractlight.cpp8
-rw-r--r--src/render/lights/qabstractlight.h2
-rw-r--r--src/render/lights/qdirectionallight.cpp5
-rw-r--r--src/render/lights/qdirectionallight.h2
-rw-r--r--src/render/lights/qpointlight.h1
-rw-r--r--src/render/lights/qspotlight.cpp10
-rw-r--r--src/render/lights/qspotlight.h2
-rw-r--r--src/render/materialsystem/qeffect.cpp11
-rw-r--r--src/render/materialsystem/qeffect.h2
-rw-r--r--src/render/materialsystem/qfilterkey.cpp11
-rw-r--r--src/render/materialsystem/qfilterkey.h4
-rw-r--r--src/render/materialsystem/qmaterial.cpp13
-rw-r--r--src/render/materialsystem/qmaterial.h2
-rw-r--r--src/render/materialsystem/qparameter.cpp9
-rw-r--r--src/render/materialsystem/qparameter.h2
-rw-r--r--src/render/materialsystem/qrenderpass.cpp14
-rw-r--r--src/render/materialsystem/qrenderpass.h2
-rw-r--r--src/render/materialsystem/qshaderdata.cpp26
-rw-r--r--src/render/materialsystem/qshaderdata.h3
-rw-r--r--src/render/materialsystem/qshaderprogram.cpp13
-rw-r--r--src/render/materialsystem/qshaderprogram.h2
-rw-r--r--src/render/materialsystem/qtechnique.cpp15
-rw-r--r--src/render/materialsystem/qtechnique.h2
-rw-r--r--src/render/picking/qobjectpicker.cpp8
-rw-r--r--src/render/picking/qobjectpicker.h4
-rw-r--r--src/render/renderstates/qalphacoverage.h1
-rw-r--r--src/render/renderstates/qalphatest.cpp8
-rw-r--r--src/render/renderstates/qalphatest.h4
-rw-r--r--src/render/renderstates/qblendequation.cpp7
-rw-r--r--src/render/renderstates/qblendequation.h4
-rw-r--r--src/render/renderstates/qblendequationarguments.cpp15
-rw-r--r--src/render/renderstates/qblendequationarguments.h2
-rw-r--r--src/render/renderstates/qclipplane.cpp9
-rw-r--r--src/render/renderstates/qclipplane.h4
-rw-r--r--src/render/renderstates/qcolormask.cpp10
-rw-r--r--src/render/renderstates/qcolormask.h4
-rw-r--r--src/render/renderstates/qcullface.cpp7
-rw-r--r--src/render/renderstates/qcullface.h4
-rw-r--r--src/render/renderstates/qdepthtest.cpp7
-rw-r--r--src/render/renderstates/qdepthtest.h4
-rw-r--r--src/render/renderstates/qdithering.h1
-rw-r--r--src/render/renderstates/qfrontface.cpp7
-rw-r--r--src/render/renderstates/qfrontface.h4
-rw-r--r--src/render/renderstates/qmultisampleantialiasing.h1
-rw-r--r--src/render/renderstates/qnodepthmask.h1
-rw-r--r--src/render/renderstates/qpointsize.cpp11
-rw-r--r--src/render/renderstates/qpointsize.h4
-rw-r--r--src/render/renderstates/qpolygonoffset.cpp8
-rw-r--r--src/render/renderstates/qpolygonoffset.h4
-rw-r--r--src/render/renderstates/qrenderstate.cpp5
-rw-r--r--src/render/renderstates/qrenderstate.h3
-rw-r--r--src/render/renderstates/qscissortest.cpp10
-rw-r--r--src/render/renderstates/qscissortest.h4
-rw-r--r--src/render/renderstates/qseamlesscubemap.h1
-rw-r--r--src/render/renderstates/qstencilmask.cpp8
-rw-r--r--src/render/renderstates/qstencilmask.h4
-rw-r--r--src/render/renderstates/qstenciloperation.cpp12
-rw-r--r--src/render/renderstates/qstenciloperation.h4
-rw-r--r--src/render/renderstates/qstenciltest.cpp12
-rw-r--r--src/render/renderstates/qstenciltest.h4
-rw-r--r--src/render/texture/qabstracttexture.cpp21
-rw-r--r--src/render/texture/qabstracttexture.h2
-rw-r--r--src/render/texture/qabstracttextureimage.cpp13
-rw-r--r--src/render/texture/qabstracttextureimage.h1
-rw-r--r--src/render/texture/qtextureimage.cpp10
-rw-r--r--src/render/texture/qtextureimage.h2
-rw-r--r--tests/auto/core/cloning/cloning.pro8
-rw-r--r--tests/auto/core/cloning/tst_cloning.cpp138
-rw-r--r--tests/auto/core/core.pro7
-rw-r--r--tests/auto/core/nodes/tst_nodes.cpp134
-rw-r--r--tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp9
-rw-r--r--tests/auto/core/qentity/tst_qentity.cpp76
-rw-r--r--tests/auto/core/qscene/tst_qscene.cpp6
-rw-r--r--tests/auto/core/qtransform/tst_qtransform.cpp35
-rw-r--r--tests/auto/input/commons/testdevice.h9
-rw-r--r--tests/auto/input/qaction/tst_qaction.cpp36
-rw-r--r--tests/auto/input/qactioninput/tst_qactioninput.cpp38
-rw-r--r--tests/auto/input/qaxis/tst_qaxis.cpp33
-rw-r--r--tests/auto/input/qaxisinput/tst_qaxisinput.cpp41
-rw-r--r--tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp52
-rw-r--r--tests/auto/render/qabstractlight/tst_qabstractlight.cpp165
-rw-r--r--tests/auto/render/qattribute/tst_qattribute.cpp57
-rw-r--r--tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp37
-rw-r--r--tests/auto/render/qbuffer/tst_qbuffer.cpp49
-rw-r--r--tests/auto/render/qcameraselector/tst_qcameraselector.cpp39
-rw-r--r--tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp39
-rw-r--r--tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp91
-rw-r--r--tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp35
-rw-r--r--tests/auto/render/qgeometry/tst_qgeometry.cpp42
-rw-r--r--tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp63
-rw-r--r--tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp37
-rw-r--r--tests/auto/render/qmaterial/tst_qmaterial.cpp42
-rw-r--r--tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp41
-rw-r--r--tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp64
-rw-r--r--tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp41
-rw-r--r--tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp38
-rw-r--r--tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp42
-rw-r--r--tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp34
-rw-r--r--tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp51
-rw-r--r--tests/auto/render/qviewport/tst_qviewport.cpp35
205 files changed, 741 insertions, 2261 deletions
diff --git a/src/core/nodes/qcomponent.cpp b/src/core/nodes/qcomponent.cpp
index cc6b357d0..81573442d 100644
--- a/src/core/nodes/qcomponent.cpp
+++ b/src/core/nodes/qcomponent.cpp
@@ -110,7 +110,6 @@ QComponent::QComponent(QNode *parent)
QComponent::~QComponent()
{
Q_D(QComponent);
- Q_ASSERT_X(d->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DCore::QComponent subclass didn't call QNode::cleanup in its destructor");
for (QEntity *entity : qAsConst(d->m_entities)) {
QEntityPrivate *entityPimpl = static_cast<QEntityPrivate *>(QEntityPrivate::get(entity));
@@ -140,16 +139,6 @@ void QComponent::setShareable(bool shareable)
}
/*!
- Copies the \a ref.
- */
-void QComponent::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QComponent *comp = static_cast<const QComponent *>(ref);
- setShareable(comp->isShareable());
-}
-
-/*!
Returns a QVector containing all the entities that reference this component.
*/
QVector<QEntity *> QComponent::entities() const
diff --git a/src/core/nodes/qcomponent.h b/src/core/nodes/qcomponent.h
index 070959148..a303b4d5b 100644
--- a/src/core/nodes/qcomponent.h
+++ b/src/core/nodes/qcomponent.h
@@ -70,7 +70,6 @@ Q_SIGNALS:
protected:
QComponent(QComponentPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QComponent)
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index 2e84e9d69..6e8fbfcb8 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -97,11 +97,6 @@ QEntity::~QEntity()
const auto components = std::move(d->m_components);
for (QComponent *comp : components)
removeComponent(comp);
-
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- // If all children are removed
- // That includes the components that are parented by this entity
-
}
/*! \internal */
@@ -111,22 +106,6 @@ QEntity::QEntity(QEntityPrivate &dd, QNode *parent)
}
/*!
- Copies all the properties and components of the Qt3DCore::QEntity \a ref to the
- current instance.
-*/
-void QEntity::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QEntity *entity = static_cast<const QEntity*>(ref);
- d_func()->m_visible = entity->d_func()->m_visible;
- d_func()->m_parentEntityId = entity->d_func()->parentEntityId();
-
- for (QComponent *c : qAsConst(entity->d_func()->m_components)) {
- QNode *ccclone = QNode::clone(c);
- addComponent(qobject_cast<QComponent *>(ccclone));
- }
-}
-/*!
\typedef Qt3DCore::QComponentVector
\relates Qt3DCore::QEntity
diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h
index 0560ae256..aa064071c 100644
--- a/src/core/nodes/qentity.h
+++ b/src/core/nodes/qentity.h
@@ -70,11 +70,10 @@ public:
protected:
QEntity(QEntityPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QEntity)
- QT3D_CLONEABLE_CUSTOM_DTOR(QEntity)
+
QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/core/nodes/qnode.cpp b/src/core/nodes/qnode.cpp
index 9f31630a6..879ad7a07 100644
--- a/src/core/nodes/qnode.cpp
+++ b/src/core/nodes/qnode.cpp
@@ -69,7 +69,6 @@ QNodePrivate::QNodePrivate()
, m_scene(Q_NULLPTR)
, m_id(QNodeId::createId())
, m_blockNotifications(false)
- , m_wasCleanedUp(false)
, m_hasBackendNode(false)
, m_enabled(true)
, m_propertyChangesSetup(false)
@@ -82,135 +81,42 @@ void QNodePrivate::_q_addChild(QNode *childNode)
{
Q_ASSERT(childNode);
- if (ms_useCloning) {
- if (childNode == q_func())
- return;
-
- // If the scene is null it means that the current node is part of a subtree
- // that has been pre-prepared. Therefore the node shouldn't be added by
- // itself but only when the root of the said subtree is inserted into an
- // existing node whose m_scene member is valid
- if (m_scene == Q_NULLPTR)
- return;
-
- QNodeVisitor visitor;
- // Recursively set scene and change arbiter for the node subtree
- visitor.traverse(childNode, this, &QNodePrivate::setSceneHelper);
-
- // We notify only if we have a QChangeArbiter
- if (m_changeArbiter != Q_NULLPTR) {
- QNodePropertyChangePtr e(new QNodePropertyChange(NodeCreated, QSceneChange::Node, m_id));
- e->setPropertyName("node");
- // We need to clone the parent of the childNode we send
- QNode *parentClone = QNode::clone(q_func());
- QNode *childClone = Q_NULLPTR;
- for (QObject *c : parentClone->children()) {
- QNode *clone = qobject_cast<QNode *>(c);
- if (clone != Q_NULLPTR && clone->id() == childNode->id()) {
- childClone = clone;
- break;
- }
- }
- e->setValue(QVariant::fromValue(QNodePtr(childClone, &QNodePrivate::nodePtrDeleter)));
- notifyObservers(e);
- }
+ if (!m_scene)
+ return;
- // Handle Entity - Components
- visitor.traverse(childNode, this, &QNodePrivate::addEntityComponentToScene);
- } else {
- if (!m_scene)
- return;
-
- QNodeCreatedChangeGenerator generator(childNode);
- const auto creationChanges = generator.creationChanges();
- // TODO: Wrap all creation changes into a single aggregate change to avoid
- // hamemring the change arbiter when all of these need to be delivered to
- // all of the aspects.
- for (const auto &change : creationChanges)
- notifyObservers(change);
-
- // Update the scene
- // TODO: Fold this into the QNodeCreatedChangeGenerator so we don't have to
- // traverse the sub tree three times!
- QNodeVisitor visitor;
- visitor.traverse(childNode, this, &QNodePrivate::setSceneHelper);
- visitor.traverse(childNode, this, &QNodePrivate::addEntityComponentToScene);
- }
+ QNodeCreatedChangeGenerator generator(childNode);
+ const auto creationChanges = generator.creationChanges();
+ // TODO: Wrap all creation changes into a single aggregate change to avoid
+ // hamemring the change arbiter when all of these need to be delivered to
+ // all of the aspects.
+ for (const auto &change : creationChanges)
+ notifyObservers(change);
+
+ // Update the scene
+ // TODO: Fold this into the QNodeCreatedChangeGenerator so we don't have to
+ // traverse the sub tree three times!
+ QNodeVisitor visitor;
+ visitor.traverse(childNode, this, &QNodePrivate::setSceneHelper);
+ visitor.traverse(childNode, this, &QNodePrivate::addEntityComponentToScene);
}
// Called by setParent or cleanup (main thread) (could be other thread if created on the backend in a job)
void QNodePrivate::_q_removeChild(QNode *childNode)
{
Q_ASSERT(childNode);
-
- if (ms_useCloning) {
- if (childNode->parent() != q_func())
- qCWarning(Nodes) << Q_FUNC_INFO << "not a child of " << this;
-
- // Notify only if child isn't a clone
- if (m_changeArbiter != Q_NULLPTR) {
- QNodePropertyChangePtr e(new QNodePropertyChange(NodeAboutToBeDeleted, QSceneChange::Node, m_id));
- e->setPropertyName("node");
- // We need to clone the parent of the childNode we send
- // QNode *parentClone = QNode::clone(childNode->parentNode());
- // QNode *childClone = Q_NULLPTR;
- // Q_FOREACH (QObject *c, parentClone->children()) {
- // QNode *clone = qobject_cast<QNode *>(c);
- // if (clone != Q_NULLPTR && clone->id() == childNode->id()) {
- // childClone = clone;
- // break;
- // }
- // }
-
- // We cannot clone the parent as it seems that the childNode is already removed
- // from the parent when the ChildRemoved event is triggered
- // and that would therefore return us a childNode NULL (because not found in the parent's children list)
- // and crash the backend
-
- QNode *childClone = QNode::clone(childNode);
- e->setValue(QVariant::fromValue(QNodePtr(childClone, &QNodePrivate::nodePtrDeleter)));
- notifyObservers(e);
- }
-
- // Recursively unset the scene on all children
- QNodeVisitor visitor;
- visitor.traverse(childNode, this, &QNodePrivate::unsetSceneHelper);
- } else {
- auto childNodePrivate = get(childNode);
- if (childNodePrivate->m_hasBackendNode) {
- const QDestructionIdAndTypeCollector collector(childNode);
- auto destroyedChange = QNodeDestroyedChangePtr::create(childNode, collector.subtreeIdsAndTypes());
- notifyObservers(destroyedChange);
- }
-
- // Update the scene
- // TODO: Fold this into the QNodeCreatedChangeGenerator so we don't have to
- // traverse the sub tree twice
- QNodeVisitor visitor;
- visitor.traverse(childNode, this, &QNodePrivate::unsetSceneHelper);
+ if (childNode->parent() != q_func())
+ qCWarning(Nodes) << Q_FUNC_INFO << "not a child of " << this;
+
+ auto childNodePrivate = get(childNode);
+ if (childNodePrivate->m_hasBackendNode) {
+ const QDestructionIdAndTypeCollector collector(childNode);
+ auto destroyedChange = QNodeDestroyedChangePtr::create(childNode, collector.subtreeIdsAndTypes());
+ notifyObservers(destroyedChange);
}
-}
-/*!
- * This methods can only be called once and takes care of notyfing the backend
- * aspects that the current Qt3DCore::QNode instance is about to be destroyed.
- *
- * \note It must be called by the destructor of every class subclassing
- * QNode that is clonable (using the QT3D_CLONEABLE macro).
- *
- * \internal
- */
-void QNodePrivate::_q_cleanup()
-{
- if (!m_wasCleanedUp) {
- m_wasCleanedUp = true;
- Q_Q(QNode);
- qCDebug(Nodes) << Q_FUNC_INFO << q;
- if (q->parentNode())
- QNodePrivate::get(q->parentNode())->_q_removeChild(q);
- // Root element has no parent and therefore we cannot
- // call parent->_q_removeChild();
- }
+ // Update the scene
+ QNodeVisitor visitor;
+ visitor.traverse(childNode, this, &QNodePrivate::unsetSceneHelper);
}
void QNodePrivate::registerNotifiedProperties()
@@ -524,26 +430,8 @@ QNode::QNode(QNodePrivate &dd, QNode *parent)
}
}
-/*!
- Copies all the attributes from \a ref to the current Qt3DCore::QNode instance.
-
- \note When subclassing QNode, you should reimplement this method and
- always call the copy method on the base class. This will ensure that when cloned,
- the QNode is properly initialized.
-*/
-void QNode::copy(const QNode *ref)
-{
- if (ref) {
- d_func()->m_id = ref->d_func()->m_id;
- d_func()->m_enabled = ref->d_func()->m_enabled;
- setObjectName(ref->objectName());
- }
-}
-
QNode::~QNode()
{
- Q_ASSERT_X(QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DCore::QNode subclass didn't call QNode::cleanup in its destructor");
-
// Create a QNodeDestroyedChange for this node that informs the backend that
// this node and all of its children are going away
Q_D(QNode);
@@ -680,47 +568,6 @@ bool QNode::isEnabled() const
return d->m_enabled;
}
-/*!
- Returns a clone of \a node. All the children of \a node are cloned as well.
-
- \note This is the only way to create two nodes with the same id.
-*/
-QNode *QNode::clone(QNode *node)
-{
- if (node == Q_NULLPTR)
- return Q_NULLPTR;
-
- static int clearLock = 0;
- clearLock++;
-
- // We keep a reference of clones for the current subtree
- // In order to preserve relationships when multiple entities
- // reference the same component
- QNode *clonedNode = QNodePrivate::m_clonesLookupTable.value(node->id());
- if (clonedNode == Q_NULLPTR) {
- clonedNode = node->doClone();
- // doClone, returns new instance with content copied
- // and relationships added
- Q_ASSERT(node->id() == clonedNode->id());
- QNodePrivate::m_clonesLookupTable.insert(node->id(), clonedNode);
- }
- for (QObject *c : node->children()) {
- QNode *childNode = qobject_cast<QNode *>(c);
- if (childNode != Q_NULLPTR) {
- QNode *cclone = QNode::clone(childNode);
- // We use QObject::setParent instead of QNode::setParent to avoid the
- // whole overhead generated by the latter as we are only dealing with clones
- if (cclone != Q_NULLPTR)
- static_cast<QObject *>(cclone)->setParent(clonedNode);
- }
- }
-
- if (--clearLock == 0) // Cloning done
- QNodePrivate::m_clonesLookupTable.clear();
-
- return clonedNode;
-}
-
QNodeCreatedChangeBasePtr QNode::createNodeCreationChange() const
{
// TODO: Remove the qDebug() from this default implementation
diff --git a/src/core/nodes/qnode.h b/src/core/nodes/qnode.h
index cf9ec46a7..c4b42e680 100644
--- a/src/core/nodes/qnode.h
+++ b/src/core/nodes/qnode.h
@@ -61,27 +61,6 @@ class QAspectEngine;
typedef QVector<QNode *> QNodeVector;
typedef QSharedPointer<QNode> QNodePtr;
-#define QT3DCORE_QUOTE(str) #str
-#define QT3D_CLONEABLE(Class) \
- friend class Qt3DCore::QAbstractNodeFactory; \
- QNode *doClone() const Q_DECL_OVERRIDE { \
- Class *clone_ = Qt3DCore::QAbstractNodeFactory::createNode<Class>(QT3DCORE_QUOTE(Class)); \
- clone_->copy(this); \
- return clone_; \
- } \
- public: \
- virtual ~Class() { \
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection); \
- }
-
-#define QT3D_CLONEABLE_CUSTOM_DTOR(Class) \
- friend class Qt3DCore::QAbstractNodeFactory; \
- QNode *doClone() const Q_DECL_OVERRIDE { \
- Class *clone_ = Qt3DCore::QAbstractNodeFactory::createNode<Class>(QT3DCORE_QUOTE(Class)); \
- clone_->copy(this); \
- return clone_; \
- } \
-
// Each QNode subclass should call QNode::cleanup in it dtor
// QNode::cleanup checks that a flags wasn't set to true,
// sets it to true and sends a clone to the backend
@@ -114,16 +93,11 @@ Q_SIGNALS:
void enabledChanged(bool enabled);
protected:
- // Clone should only be made in the main thread
- static QNode *clone(QNode *node);
-
QNode(QNodePrivate &dd, QNode *parent = Q_NULLPTR);
- virtual void copy(const QNode *ref);
virtual void sceneChangeEvent(const QSceneChangePtr &change);
private:
Q_DECLARE_PRIVATE(QNode)
- virtual QNode *doClone() const = 0;
// TODO: Make this pure virtual once all classes have been adapted
virtual QNodeCreatedChangeBasePtr createNodeCreationChange() const;
@@ -133,7 +107,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_addChild(Qt3DCore::QNode *))
Q_PRIVATE_SLOT(d_func(), void _q_removeChild(Qt3DCore::QNode *))
- Q_PRIVATE_SLOT(d_func(), void _q_cleanup())
friend class QAspectEngine;
friend class QAspectEnginePrivate;
diff --git a/src/core/nodes/qnode_p.h b/src/core/nodes/qnode_p.h
index 3b0ee3773..0851985bb 100644
--- a/src/core/nodes/qnode_p.h
+++ b/src/core/nodes/qnode_p.h
@@ -89,7 +89,6 @@ public:
QScene *m_scene;
mutable QNodeId m_id;
bool m_blockNotifications;
- bool m_wasCleanedUp;
bool m_hasBackendNode;
bool m_enabled;
@@ -99,7 +98,6 @@ public:
private:
void _q_addChild(QNode *childNode);
void _q_removeChild(QNode *childNode);
- void _q_cleanup();
void registerNotifiedProperties();
void unregisterNotifiedProperties();
void propertyChanged(int propertyIndex);
diff --git a/src/core/nodes/qnodecreatedchangegenerator_p.h b/src/core/nodes/qnodecreatedchangegenerator_p.h
index 7011af526..8bec039c3 100644
--- a/src/core/nodes/qnodecreatedchangegenerator_p.h
+++ b/src/core/nodes/qnodecreatedchangegenerator_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
namespace Qt3DCore {
-class QNodeCreatedChangeGenerator
+class Q_AUTOTEST_EXPORT QNodeCreatedChangeGenerator
{
public:
QNodeCreatedChangeGenerator(QNode *rootNode);
diff --git a/src/core/transforms/qtransform.cpp b/src/core/transforms/qtransform.cpp
index 960cce33c..b00940a7a 100644
--- a/src/core/transforms/qtransform.cpp
+++ b/src/core/transforms/qtransform.cpp
@@ -186,20 +186,6 @@ QTransform::QTransform(QTransformPrivate &dd, QNode *parent)
{
}
-void QTransform::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QTransform *transform = static_cast<const QTransform *>(ref);
- // We need to copy the matrix with all the pending
- // transformations applied
- d_func()->m_matrix = transform->matrix();
- d_func()->m_rotation = transform->rotation();
- d_func()->m_scale = transform->scale3D();
- d_func()->m_translation = transform->translation();
- d_func()->m_eulerRotationAngles = transform->d_func()->m_eulerRotationAngles;
- d_func()->m_matrixDirty = transform->d_func()->m_matrixDirty;
-}
-
void QTransform::setMatrix(const QMatrix4x4 &m)
{
Q_D(QTransform);
diff --git a/src/core/transforms/qtransform.h b/src/core/transforms/qtransform.h
index e8dab0758..a07da2533 100644
--- a/src/core/transforms/qtransform.h
+++ b/src/core/transforms/qtransform.h
@@ -114,11 +114,9 @@ Q_SIGNALS:
protected:
QTransform(QTransformPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QTransform)
- QT3D_CLONEABLE(QTransform)
QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qabstractphysicaldevice.cpp b/src/input/frontend/qabstractphysicaldevice.cpp
index ab56ca57b..1d876133f 100644
--- a/src/input/frontend/qabstractphysicaldevice.cpp
+++ b/src/input/frontend/qabstractphysicaldevice.cpp
@@ -90,14 +90,6 @@ QAbstractPhysicalDevice::QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate
}
/*!
- Deletes the QAbstractPhysicalDevice instance.
- */
-QAbstractPhysicalDevice::~QAbstractPhysicalDevice()
-{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DInput::QAbstractPhysicalDevice subclass didn't call QNode::cleanup in its destructor");
-}
-
-/*!
Return the number of axis this device has.
*/
int QAbstractPhysicalDevice::axisCount() const
@@ -224,15 +216,6 @@ void QAbstractPhysicalDevicePrivate::postButtonEvent(int button, qreal value)
notifyObservers(change);
}
-void QAbstractPhysicalDevice::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAbstractPhysicalDevice *physicalDevice = static_cast<const QAbstractPhysicalDevice *>(ref);
- d_func()->m_axisSettings = physicalDevice->d_func()->m_axisSettings;
- d_func()->m_axesHash = physicalDevice->d_func()->m_axesHash;
- d_func()->m_buttonsHash = physicalDevice->d_func()->m_buttonsHash;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QAbstractPhysicalDevice::createNodeCreationChange() const
{
auto creationChange = QPhysicalDeviceCreatedChangeBasePtr::create(this);
diff --git a/src/input/frontend/qabstractphysicaldevice.h b/src/input/frontend/qabstractphysicaldevice.h
index 1836c0e9d..94b23bd14 100644
--- a/src/input/frontend/qabstractphysicaldevice.h
+++ b/src/input/frontend/qabstractphysicaldevice.h
@@ -58,7 +58,6 @@ class QT3DINPUTSHARED_EXPORT QAbstractPhysicalDevice : public Qt3DCore::QNode
Q_OBJECT
public:
explicit QAbstractPhysicalDevice(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QAbstractPhysicalDevice();
virtual int axisCount() const;
virtual int buttonCount() const;
@@ -75,7 +74,6 @@ public:
protected:
QAbstractPhysicalDevice(QAbstractPhysicalDevicePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
Q_DECLARE_PRIVATE(QAbstractPhysicalDevice)
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qaction.cpp b/src/input/frontend/qaction.cpp
index 76422ee98..987ce6ca1 100644
--- a/src/input/frontend/qaction.cpp
+++ b/src/input/frontend/qaction.cpp
@@ -155,14 +155,6 @@ QVector<QAbstractActionInput *> QAction::inputs() const
return d->m_inputs;
}
-void QAction::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QAction *action = static_cast<const QAction *>(ref);
- Q_FOREACH (QAbstractActionInput *input, action->inputs())
- d_func()->m_inputs.append(qobject_cast<QAbstractActionInput *>(QNode::clone(input)));
-}
-
void QAction::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QAction);
diff --git a/src/input/frontend/qaction.h b/src/input/frontend/qaction.h
index e7643d8d1..442d58e7c 100644
--- a/src/input/frontend/qaction.h
+++ b/src/input/frontend/qaction.h
@@ -67,12 +67,10 @@ Q_SIGNALS:
void activeChanged(bool isActive);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QAction)
- QT3D_CLONEABLE(QAction)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qactioninput.cpp b/src/input/frontend/qactioninput.cpp
index 3e885c209..666ec493b 100644
--- a/src/input/frontend/qactioninput.cpp
+++ b/src/input/frontend/qactioninput.cpp
@@ -177,14 +177,6 @@ void QActionInput::setButtons(const QVariantList &buttons)
}
}
-void QActionInput::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QActionInput *input = static_cast<const QActionInput *>(ref);
- d_func()->m_sourceDevice = qobject_cast<QAbstractPhysicalDevice *>(QNode::clone(input->d_func()->m_sourceDevice));
- d_func()->m_buttons = input->d_func()->m_buttons;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QActionInput::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QActionInputData>::create(this);
diff --git a/src/input/frontend/qactioninput.h b/src/input/frontend/qactioninput.h
index 9f89b5f15..89c912ef4 100644
--- a/src/input/frontend/qactioninput.h
+++ b/src/input/frontend/qactioninput.h
@@ -71,12 +71,8 @@ Q_SIGNALS:
void sourceDeviceChanged(QAbstractPhysicalDevice *sourceDevice);
void buttonsChanged(const QVariantList &buttons);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QActionInput)
- QT3D_CLONEABLE(QActionInput)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qaxis.cpp b/src/input/frontend/qaxis.cpp
index b506dbc03..d5ffb9cb5 100644
--- a/src/input/frontend/qaxis.cpp
+++ b/src/input/frontend/qaxis.cpp
@@ -113,15 +113,6 @@ float QAxis::value() const
return d->m_value;
}
-void QAxis::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QAxis *axis = static_cast<const QAxis *>(ref);
- Q_FOREACH (QAxisInput *input, axis->inputs())
- d_func()->m_inputs.append(qobject_cast<QAxisInput *>(QNode::clone(input)));
-
-}
-
void QAxis::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QAxis);
diff --git a/src/input/frontend/qaxis.h b/src/input/frontend/qaxis.h
index e84c829b6..d7532d04e 100644
--- a/src/input/frontend/qaxis.h
+++ b/src/input/frontend/qaxis.h
@@ -66,12 +66,10 @@ Q_SIGNALS:
void valueChanged(float value);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QAxis)
- QT3D_CLONEABLE(QAxis)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qaxisinput.cpp b/src/input/frontend/qaxisinput.cpp
index b1a9b6ec5..e5cb0c054 100644
--- a/src/input/frontend/qaxisinput.cpp
+++ b/src/input/frontend/qaxisinput.cpp
@@ -131,16 +131,6 @@ QVariantList QAxisInput::buttons() const
return d->m_buttons;
}
-void QAxisInput::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QAxisInput *input = static_cast<const QAxisInput *>(ref);
- d_func()->m_sourceDevice = qobject_cast<QAbstractPhysicalDevice *>(QNode::clone(input->d_func()->m_sourceDevice));
- d_func()->m_buttons = input->d_func()->m_buttons;
- d_func()->m_scale = input->d_func()->m_scale;
- d_func()->m_axis = input->d_func()->m_axis;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QAxisInput::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAxisInputData>::create(this);
diff --git a/src/input/frontend/qaxisinput.h b/src/input/frontend/qaxisinput.h
index 056af403d..97e3f1eeb 100644
--- a/src/input/frontend/qaxisinput.h
+++ b/src/input/frontend/qaxisinput.h
@@ -79,12 +79,8 @@ Q_SIGNALS:
void axisChanged(int axis);
void buttonsChanged(const QVariantList &buttons);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QAxisInput)
- QT3D_CLONEABLE(QAxisInput)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qaxissetting.cpp b/src/input/frontend/qaxissetting.cpp
index 2a230e69b..7614f9e8d 100644
--- a/src/input/frontend/qaxissetting.cpp
+++ b/src/input/frontend/qaxissetting.cpp
@@ -115,15 +115,6 @@ void QAxisSetting::setSmoothEnabled(bool enabled)
emit smoothChanged(enabled);
}
-void QAxisSetting::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QAxisSetting *setting = static_cast<const QAxisSetting *>(ref);
- d_func()->m_deadZoneRadius = setting->d_func()->m_deadZoneRadius;
- d_func()->m_axes = setting->d_func()->m_axes;
- d_func()->m_smooth = setting->d_func()->m_smooth;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QAxisSetting::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAxisSettingData>::create(this);
diff --git a/src/input/frontend/qaxissetting.h b/src/input/frontend/qaxissetting.h
index b2c591ada..033b6fa7b 100644
--- a/src/input/frontend/qaxissetting.h
+++ b/src/input/frontend/qaxissetting.h
@@ -75,12 +75,8 @@ Q_SIGNALS:
void axesChanged(QVariantList axes);
void smoothChanged(bool smooth);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QAxisSetting)
- QT3D_CLONEABLE(QAxisSetting)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qgenericinputdevice_p.h b/src/input/frontend/qgenericinputdevice_p.h
index fd2d516d0..011f3864f 100644
--- a/src/input/frontend/qgenericinputdevice_p.h
+++ b/src/input/frontend/qgenericinputdevice_p.h
@@ -74,9 +74,6 @@ public:
Q_SIGNALS:
void axesMapChanged();
void buttonsMapChanged();
-
-protected:
- QT3D_CLONEABLE(QGenericInputDevice)
};
} // Qt3DInput
diff --git a/src/input/frontend/qinputchord.cpp b/src/input/frontend/qinputchord.cpp
index d012e0b7b..a423abdc0 100644
--- a/src/input/frontend/qinputchord.cpp
+++ b/src/input/frontend/qinputchord.cpp
@@ -187,15 +187,6 @@ QVector<QAbstractActionInput *> QInputChord::chords() const
return d->m_chords;
}
-
-void QInputChord::copy(const Qt3DCore::QNode *ref)
-{
- QAbstractActionInput::copy(ref);
- const QInputChord *input = static_cast<const QInputChord *>(ref);
- d_func()->m_timeout = input->d_func()->m_timeout;
- d_func()->m_chords = input->chords();
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QInputChord::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QInputChordData>::create(this);
diff --git a/src/input/frontend/qinputchord.h b/src/input/frontend/qinputchord.h
index ba86eb896..404fc8624 100644
--- a/src/input/frontend/qinputchord.h
+++ b/src/input/frontend/qinputchord.h
@@ -71,12 +71,8 @@ public Q_SLOTS:
Q_SIGNALS:
void timeoutChanged(int timeout);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QInputChord)
- QT3D_CLONEABLE(QInputChord)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qinputsequence.cpp b/src/input/frontend/qinputsequence.cpp
index 3f180c674..c3076466f 100644
--- a/src/input/frontend/qinputsequence.cpp
+++ b/src/input/frontend/qinputsequence.cpp
@@ -232,14 +232,6 @@ QVector<QAbstractActionInput *> QInputSequence::sequences() const
return d->m_sequences;
}
-void QInputSequence::copy(const Qt3DCore::QNode *ref)
-{
- const QInputSequence *input = static_cast<const QInputSequence *>(ref);
- d_func()->m_timeout = input->d_func()->m_timeout;
- d_func()->m_buttonInterval = input->d_func()->m_buttonInterval;
- d_func()->m_sequences = input->sequences();
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QInputSequence::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QInputSequenceData>::create(this);
diff --git a/src/input/frontend/qinputsequence.h b/src/input/frontend/qinputsequence.h
index 07ca7490c..e6b067774 100644
--- a/src/input/frontend/qinputsequence.h
+++ b/src/input/frontend/qinputsequence.h
@@ -75,12 +75,8 @@ Q_SIGNALS:
void timeoutChanged(int timeout);
void buttonIntervalChanged(int buttonInterval);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QInputSequence)
- QT3D_CLONEABLE(QInputSequence)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qinputsettings.h b/src/input/frontend/qinputsettings.h
index 9a5979edb..c306ddd96 100644
--- a/src/input/frontend/qinputsettings.h
+++ b/src/input/frontend/qinputsettings.h
@@ -66,7 +66,6 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QInputSettings)
- QT3D_CLONEABLE(QInputSettings)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qkeyboarddevice.h b/src/input/frontend/qkeyboarddevice.h
index dbcf39e5b..70ed438fd 100644
--- a/src/input/frontend/qkeyboarddevice.h
+++ b/src/input/frontend/qkeyboarddevice.h
@@ -77,7 +77,6 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QKeyboardDevice)
- QT3D_CLONEABLE(QKeyboardDevice)
void setActiveInput(QKeyboardHandler *activeInput);
};
diff --git a/src/input/frontend/qkeyboardhandler.cpp b/src/input/frontend/qkeyboardhandler.cpp
index b861298dc..0e9b969d9 100644
--- a/src/input/frontend/qkeyboardhandler.cpp
+++ b/src/input/frontend/qkeyboardhandler.cpp
@@ -158,17 +158,6 @@ QKeyboardHandler::QKeyboardHandler(QNode *parent)
{
}
-void QKeyboardHandler::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QKeyboardHandler *input = static_cast<const QKeyboardHandler *>(ref);
-
- // TO DO: We may want to store the keyboard device id and only send a clone when we are the parent
- // of the keyboard device
- if (input->d_func()->m_keyboardDevice != Q_NULLPTR && input->d_func()->m_keyboardDevice->parent() == ref)
- setSourceDevice(qobject_cast<QKeyboardDevice *>(QNode::clone(input->d_func()->m_keyboardDevice)));
-}
-
void QKeyboardHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QKeyboardHandler);
diff --git a/src/input/frontend/qkeyboardhandler.h b/src/input/frontend/qkeyboardhandler.h
index ed253b309..2a5196775 100644
--- a/src/input/frontend/qkeyboardhandler.h
+++ b/src/input/frontend/qkeyboardhandler.h
@@ -115,12 +115,10 @@ Q_SIGNALS:
void released(Qt3DInput::QKeyEvent *event);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QKeyboardHandler)
- QT3D_CLONEABLE(QKeyboardHandler)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qlogicaldevice.cpp b/src/input/frontend/qlogicaldevice.cpp
index 96be0438e..9737b4afa 100644
--- a/src/input/frontend/qlogicaldevice.cpp
+++ b/src/input/frontend/qlogicaldevice.cpp
@@ -246,16 +246,6 @@ QVector<QAxis *> QLogicalDevice::axes() const
return d->m_axes;
}
-void QLogicalDevice::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QLogicalDevice *device = static_cast<const QLogicalDevice *>(ref);
- Q_FOREACH (QAction *action, device->actions())
- d_func()->m_actions.push_back(qobject_cast<QAction *>(QNode::clone(action)));
- Q_FOREACH (QAxis *axis, device->axes())
- d_func()->m_axes.push_back(qobject_cast<QAxis *>(QNode::clone(axis)));
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QLogicalDevice::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QLogicalDeviceData>::create(this);
diff --git a/src/input/frontend/qlogicaldevice.h b/src/input/frontend/qlogicaldevice.h
index f0c7392a1..f42deaa73 100644
--- a/src/input/frontend/qlogicaldevice.h
+++ b/src/input/frontend/qlogicaldevice.h
@@ -65,12 +65,8 @@ public:
void removeAxis(QAxis *axis);
QVector<QAxis *> axes() const;
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QLogicalDevice)
- QT3D_CLONEABLE(QLogicalDevice)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qmousedevice.cpp b/src/input/frontend/qmousedevice.cpp
index 3def81185..49e925a49 100644
--- a/src/input/frontend/qmousedevice.cpp
+++ b/src/input/frontend/qmousedevice.cpp
@@ -127,13 +127,6 @@ void QMouseDevice::setSensitivity(float value)
emit sensitivityChanged(value);
}
-void QMouseDevice::copy(const Qt3DCore::QNode *ref)
-{
- QNode::copy(ref);
- const QMouseDevice *object = static_cast<const QMouseDevice *>(ref);
- d_func()->m_sensitivity = object->d_func()->m_sensitivity;
-}
-
void QMouseDevice::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_UNUSED(change);
diff --git a/src/input/frontend/qmousedevice.h b/src/input/frontend/qmousedevice.h
index 32a9d87a9..5ba1be595 100644
--- a/src/input/frontend/qmousedevice.h
+++ b/src/input/frontend/qmousedevice.h
@@ -81,12 +81,10 @@ Q_SIGNALS:
void sensitivityChanged(float value);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QMouseDevice)
- QT3D_CLONEABLE(QMouseDevice)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/input/frontend/qmousehandler.cpp b/src/input/frontend/qmousehandler.cpp
index 88d12feee..8ff0b0e17 100644
--- a/src/input/frontend/qmousehandler.cpp
+++ b/src/input/frontend/qmousehandler.cpp
@@ -161,20 +161,6 @@ void QMouseHandler::setContainsMouse(bool contains)
}
}
-void QMouseHandler::copy(const QNode *ref)
-{
- Q_D(QMouseHandler);
- const QMouseHandler *refInput = static_cast<const QMouseHandler *>(ref);
- d->m_containsMouse = refInput->containsMouse();
-
- // TODO: We may want to store the device id and only send a clone when we are the parent
- // of the device.
- // Perhaps it's time to investigate sending a "kernel" or "seed" over to the backend rather
- // than a complete clone.
- if (refInput && refInput->sourceDevice() && refInput->sourceDevice()->parent() == ref)
- d->m_mouseDevice = static_cast<QMouseDevice *>(QNode::clone(refInput->sourceDevice()));
-}
-
void QMouseHandler::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QMouseHandler);
diff --git a/src/input/frontend/qmousehandler.h b/src/input/frontend/qmousehandler.h
index deca370b4..fbf62a127 100644
--- a/src/input/frontend/qmousehandler.h
+++ b/src/input/frontend/qmousehandler.h
@@ -84,13 +84,11 @@ Q_SIGNALS:
void wheel(Qt3DInput::QWheelEvent *wheel);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
void setContainsMouse(bool contains);
private:
Q_DECLARE_PRIVATE(QMouseHandler)
- QT3D_CLONEABLE(QMouseHandler)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/logic/qframeaction.h b/src/logic/qframeaction.h
index 9000c916e..7c04d074a 100644
--- a/src/logic/qframeaction.h
+++ b/src/logic/qframeaction.h
@@ -69,8 +69,6 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QFrameAction)
- QT3D_CLONEABLE(QFrameAction)
-
void onTriggered(float dt);
friend class Logic::Executor;
diff --git a/src/plugins/sceneparsers/assimp/assimpparser.cpp b/src/plugins/sceneparsers/assimp/assimpparser.cpp
index 176ec0c79..38a343d65 100644
--- a/src/plugins/sceneparsers/assimp/assimpparser.cpp
+++ b/src/plugins/sceneparsers/assimp/assimpparser.cpp
@@ -312,7 +312,6 @@ public:
private:
QByteArray m_data;
- QT3D_CLONEABLE(AssimpRawTextureImage)
class AssimpRawTextureImageFunctor : public QTextureImageDataGenerator
{
diff --git a/src/quick3d/quick3d/items/quick3dentityloader.cpp b/src/quick3d/quick3d/items/quick3dentityloader.cpp
index 0e72cba6b..119b2e66d 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader.cpp
+++ b/src/quick3d/quick3d/items/quick3dentityloader.cpp
@@ -132,15 +132,6 @@ void Quick3DEntityLoader::setSource(const QUrl &url)
d->loadFromSource();
}
-void Quick3DEntityLoader::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const Quick3DEntityLoader *loader = static_cast<const Quick3DEntityLoader*>(ref);
- d_func()->m_source = loader->d_func()->m_source;
- d_func()->m_entity = static_cast<QEntity*>(QNode::clone(loader->d_func()->m_entity));
- d_func()->m_entity->setParent(this);
-}
-
Quick3DEntityLoaderPrivate::Quick3DEntityLoaderPrivate()
: QEntityPrivate(),
m_incubator(Q_NULLPTR),
diff --git a/src/quick3d/quick3d/items/quick3dentityloader_p.h b/src/quick3d/quick3d/items/quick3dentityloader_p.h
index fe470653f..928f31ada 100644
--- a/src/quick3d/quick3d/items/quick3dentityloader_p.h
+++ b/src/quick3d/quick3d/items/quick3dentityloader_p.h
@@ -86,13 +86,9 @@ Q_SIGNALS:
void entityChanged();
void sourceChanged();
-protected:
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(Quick3DEntityLoader)
Q_PRIVATE_SLOT(d_func(), void _q_componentStatusChanged(QQmlComponent::Status))
- QT3D_CLONEABLE(Quick3DEntityLoader)
};
} // namespace Quick
diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp
index aff179f17..e9b084a3d 100644
--- a/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp
+++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator.cpp
@@ -498,21 +498,22 @@ void Quick3DNodeInstantiator::componentComplete()
}
}
-void Quick3DNodeInstantiator::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const Quick3DNodeInstantiator *instantiator = static_cast<const Quick3DNodeInstantiator*>(ref);
- // We only need to clone the children as the instantiator itself has no
- // corresponding backend node type.
- for (int i = 0; i < instantiator->d_func()->m_objects.size(); ++i) {
- QNode *n = qobject_cast<QNode *>(instantiator->d_func()->m_objects.at(i));
- if (!n)
- continue;
- QNode *clonedNode = QNode::clone(n);
- clonedNode->setParent(this);
- d_func()->m_objects.append(clonedNode);
- }
-}
+// TODO: Avoid cloning here
+//void Quick3DNodeInstantiator::copy(const QNode *ref)
+//{
+// QNode::copy(ref);
+// const Quick3DNodeInstantiator *instantiator = static_cast<const Quick3DNodeInstantiator*>(ref);
+// // We only need to clone the children as the instantiator itself has no
+// // corresponding backend node type.
+// for (int i = 0; i < instantiator->d_func()->m_objects.size(); ++i) {
+// QNode *n = qobject_cast<QNode *>(instantiator->d_func()->m_objects.at(i));
+// if (!n)
+// continue;
+// QNode *clonedNode = QNode::clone(n);
+// clonedNode->setParent(this);
+// d_func()->m_objects.append(clonedNode);
+// }
+//}
} // namespace Quick
} // namespace Qt3DCore
diff --git a/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h b/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
index d1fc88147..d861fc2fe 100644
--- a/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
+++ b/src/quick3d/quick3d/items/quick3dnodeinstantiator_p.h
@@ -112,11 +112,7 @@ Q_SIGNALS:
void objectAdded(int index, QObject *object);
void objectRemoved(int index, QObject *object);
-protected:
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
private:
- QT3D_CLONEABLE(Quick3DNodeInstantiator)
Q_DISABLE_COPY(Quick3DNodeInstantiator)
Q_DECLARE_PRIVATE(Quick3DNodeInstantiator)
Q_PRIVATE_SLOT(d_func(), void _q_createdItem(int, QObject *))
diff --git a/src/quick3d/quick3drender/items/quick3dparameter_p.h b/src/quick3d/quick3drender/items/quick3dparameter_p.h
index 051e7b253..60493973d 100644
--- a/src/quick3d/quick3drender/items/quick3dparameter_p.h
+++ b/src/quick3d/quick3drender/items/quick3dparameter_p.h
@@ -73,7 +73,6 @@ private:
protected:
Quick3DParameter(Quick3DParameterPrivate &dd, QNode *parent = 0);
- QT3D_CLONEABLE(Quick3DParameter)
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdata_p.h b/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
index ac55e0b5d..72c117c90 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
+++ b/src/quick3d/quick3drender/items/quick3dshaderdata_p.h
@@ -68,9 +68,6 @@ class QT3DQUICKRENDERSHARED_PRIVATE_EXPORT Quick3DShaderData : public QShaderDat
Q_OBJECT
public:
explicit Quick3DShaderData(QNode *parent = 0);
-
-private:
- QT3D_CLONEABLE(Quick3DShaderData)
};
} // namespace Quick
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp b/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp
index f9522f87d..21dd2525a 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp
+++ b/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp
@@ -76,13 +76,14 @@ QVector<QShaderData *> Quick3DShaderDataArray::values() const
return d->m_values;
}
-void Quick3DShaderDataArray::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const Quick3DShaderDataArray *dataArray = static_cast<const Quick3DShaderDataArray *>(ref);
- Q_FOREACH (QShaderData *v, dataArray->d_func()->m_values)
- d_func()->m_values.append(static_cast<QShaderData *>(QNode::clone(v)));
-}
+// TODO: Avoid cloning here
+//void Quick3DShaderDataArray::copy(const QNode *ref)
+//{
+// QNode::copy(ref);
+// const Quick3DShaderDataArray *dataArray = static_cast<const Quick3DShaderDataArray *>(ref);
+// Q_FOREACH (QShaderData *v, dataArray->d_func()->m_values)
+// d_func()->m_values.append(static_cast<QShaderData *>(QNode::clone(v)));
+//}
void Quick3DShaderDataArray::appendValue(QQmlListProperty<QShaderData> *list, QShaderData *bar)
{
diff --git a/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h b/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
index 7f68e1456..effd18b32 100644
--- a/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
+++ b/src/quick3d/quick3drender/items/quick3dshaderdataarray_p.h
@@ -79,16 +79,12 @@ public:
QQmlListProperty<QShaderData> valuesList();
QVector<QShaderData *> values() const;
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
static void appendValue(QQmlListProperty<QShaderData> *list, QShaderData *bar);
static QShaderData *valueAt(QQmlListProperty<QShaderData> *list, int index);
static int valueCount(QQmlListProperty<QShaderData> *list);
static void clearValues(QQmlListProperty<QShaderData> *list);
Q_DECLARE_PRIVATE(Quick3DShaderDataArray)
- QT3D_CLONEABLE(Quick3DShaderDataArray)
};
} // namespace Quick
diff --git a/src/render/framegraph/qcameraselector.cpp b/src/render/framegraph/qcameraselector.cpp
index 81a5ea8ad..452bd71f2 100644
--- a/src/render/framegraph/qcameraselector.cpp
+++ b/src/render/framegraph/qcameraselector.cpp
@@ -61,20 +61,13 @@ QCameraSelector::QCameraSelector(QCameraSelectorPrivate &dd, QNode *parent)
QCameraSelectorPrivate::QCameraSelectorPrivate()
: QFrameGraphNodePrivate()
, m_camera(Q_NULLPTR)
-{}
-
-void QCameraSelector::copy(const QNode *ref)
{
- QFrameGraphNode::copy(ref);
- const QCameraSelector *other = static_cast<const QCameraSelector*>(ref);
-
- if (other->d_func()->m_camera)
- setCamera(qobject_cast<Qt3DCore::QEntity *>(QNode::clone(other->d_func()->m_camera)));
}
QCameraSelector::QCameraSelector(Qt3DCore::QNode *parent)
: QFrameGraphNode(*new QCameraSelectorPrivate, parent)
-{}
+{
+}
/*!
\property Qt3DRender::QCameraSelector::camera
diff --git a/src/render/framegraph/qcameraselector.h b/src/render/framegraph/qcameraselector.h
index 9e9e9ba55..9ed2b17a1 100644
--- a/src/render/framegraph/qcameraselector.h
+++ b/src/render/framegraph/qcameraselector.h
@@ -67,10 +67,8 @@ Q_SIGNALS:
protected:
QCameraSelector(QCameraSelectorPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
- QT3D_CLONEABLE(QCameraSelector)
Q_DECLARE_PRIVATE(QCameraSelector)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qclearbuffers.cpp b/src/render/framegraph/qclearbuffers.cpp
index 3fbce4016..b241f7bc0 100644
--- a/src/render/framegraph/qclearbuffers.cpp
+++ b/src/render/framegraph/qclearbuffers.cpp
@@ -53,16 +53,6 @@ QClearBuffersPrivate::QClearBuffersPrivate()
{
}
-void QClearBuffers::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QClearBuffers *b = static_cast<const QClearBuffers*>(ref);
- d_func()->m_buffersType = b->d_func()->m_buffersType;
- d_func()->m_clearColor = b->d_func()->m_clearColor;
- d_func()->m_clearDepthValue = b->d_func()->m_clearDepthValue;
- d_func()->m_clearStencilValue = b->d_func()->m_clearStencilValue;
-}
-
QClearBuffers::QClearBuffers(QNode *parent)
: QFrameGraphNode(*new QClearBuffersPrivate, parent)
{
diff --git a/src/render/framegraph/qclearbuffers.h b/src/render/framegraph/qclearbuffers.h
index 2f75295cf..75c2c20c4 100644
--- a/src/render/framegraph/qclearbuffers.h
+++ b/src/render/framegraph/qclearbuffers.h
@@ -92,11 +92,9 @@ Q_SIGNALS:
protected:
explicit QClearBuffers(QClearBuffersPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QClearBuffers)
- QT3D_CLONEABLE(QClearBuffers)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qdispatchcompute.cpp b/src/render/framegraph/qdispatchcompute.cpp
index 1d9b72ac1..5f83ffb53 100644
--- a/src/render/framegraph/qdispatchcompute.cpp
+++ b/src/render/framegraph/qdispatchcompute.cpp
@@ -95,15 +95,6 @@ void QDispatchCompute::setWorkGroupZ(int workGroupZ)
}
-void QDispatchCompute::copy(const Qt3DCore::QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QDispatchCompute *dispatch = static_cast<const QDispatchCompute *>(ref);
- d_func()->m_workGroupX = dispatch->workGroupX();
- d_func()->m_workGroupY = dispatch->workGroupY();
- d_func()->m_workGroupZ = dispatch->workGroupZ();
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QDispatchCompute::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QDispatchComputeData>::create(this);
diff --git a/src/render/framegraph/qdispatchcompute.h b/src/render/framegraph/qdispatchcompute.h
index 7884b80e6..24a4fced1 100644
--- a/src/render/framegraph/qdispatchcompute.h
+++ b/src/render/framegraph/qdispatchcompute.h
@@ -72,12 +72,7 @@ Q_SIGNALS:
void workGroupYChanged();
void workGroupZChanged();
- // QNode interface
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
- QT3D_CLONEABLE(QDispatchCompute)
Q_DECLARE_PRIVATE(QDispatchCompute)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qframegraphnode.cpp b/src/render/framegraph/qframegraphnode.cpp
index 410bea676..6a707c57c 100644
--- a/src/render/framegraph/qframegraphnode.cpp
+++ b/src/render/framegraph/qframegraphnode.cpp
@@ -78,11 +78,6 @@ QFrameGraphNode::QFrameGraphNode(QNode *parent)
{
}
-QFrameGraphNode::~QFrameGraphNode()
-{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QFrameGraphNode subclass didn't call QNode::cleanup in its destructor");
-}
-
/*!
Returns a pointer to the parent.
*/
diff --git a/src/render/framegraph/qframegraphnode.h b/src/render/framegraph/qframegraphnode.h
index 5d4441204..fe128e1b7 100644
--- a/src/render/framegraph/qframegraphnode.h
+++ b/src/render/framegraph/qframegraphnode.h
@@ -55,7 +55,6 @@ class QT3DRENDERSHARED_EXPORT QFrameGraphNode : public Qt3DCore::QNode
Q_OBJECT
public:
explicit QFrameGraphNode(Qt3DCore::QNode *parent = Q_NULLPTR);
- ~QFrameGraphNode();
QFrameGraphNode *parentFrameGraphNode() const;
diff --git a/src/render/framegraph/qfrustumculling.h b/src/render/framegraph/qfrustumculling.h
index 16874f941..5a1bf6e9d 100644
--- a/src/render/framegraph/qfrustumculling.h
+++ b/src/render/framegraph/qfrustumculling.h
@@ -51,9 +51,6 @@ class QT3DRENDERSHARED_EXPORT QFrustumCulling : public QFrameGraphNode
Q_OBJECT
public:
explicit QFrustumCulling(Qt3DCore::QNode *parent = Q_NULLPTR);
-
-private:
- QT3D_CLONEABLE(QFrustumCulling)
};
} // Qt3DRender
diff --git a/src/render/framegraph/qlayerfilter.cpp b/src/render/framegraph/qlayerfilter.cpp
index 2322bd391..5a9f9d692 100644
--- a/src/render/framegraph/qlayerfilter.cpp
+++ b/src/render/framegraph/qlayerfilter.cpp
@@ -66,17 +66,6 @@ QLayerFilterPrivate::QLayerFilterPrivate()
\brief For ...
*/
-/*! \fn void Qt3DRender::QLayerFilter::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-void QLayerFilter::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QLayerFilter *layer = static_cast<const QLayerFilter*>(ref);
- d_func()->m_layers = layer->d_func()->m_layers;
-}
-
-
/*! \fn Qt3DRender::QLayerFilter::QLayerFilter(Qt3DCore::QNode *parent)
Constructs a new QLayerFilter with the specified \a parent.
*/
diff --git a/src/render/framegraph/qlayerfilter.h b/src/render/framegraph/qlayerfilter.h
index c1da1c9cb..ccbca2219 100644
--- a/src/render/framegraph/qlayerfilter.h
+++ b/src/render/framegraph/qlayerfilter.h
@@ -66,11 +66,9 @@ Q_SIGNALS:
protected:
QLayerFilter(QLayerFilterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QLayerFilter)
- QT3D_CLONEABLE(QLayerFilter)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qnodraw.h b/src/render/framegraph/qnodraw.h
index c776f92b1..247d37da1 100644
--- a/src/render/framegraph/qnodraw.h
+++ b/src/render/framegraph/qnodraw.h
@@ -51,9 +51,6 @@ class QT3DRENDERSHARED_EXPORT QNoDraw : public QFrameGraphNode
Q_OBJECT
public:
explicit QNoDraw(Qt3DCore::QNode *parent = Q_NULLPTR);
-
-private:
- QT3D_CLONEABLE(QNoDraw)
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qrenderpassfilter.cpp b/src/render/framegraph/qrenderpassfilter.cpp
index b702a8e1f..472dd2402 100644
--- a/src/render/framegraph/qrenderpassfilter.cpp
+++ b/src/render/framegraph/qrenderpassfilter.cpp
@@ -103,16 +103,6 @@ void QRenderPassFilter::removeMatch(QFilterKey *filterKey)
d->m_matchList.removeOne(filterKey);
}
-void QRenderPassFilter::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QRenderPassFilter *other = static_cast<const QRenderPassFilter*>(ref);
- Q_FOREACH (QFilterKey *c, other->d_func()->m_matchList)
- addMatch(qobject_cast<QFilterKey *>(QNode::clone(c)));
- for (QParameter *p : other->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-}
-
void QRenderPassFilter::addParameter(QParameter *parameter)
{
Q_ASSERT(parameter);
diff --git a/src/render/framegraph/qrenderpassfilter.h b/src/render/framegraph/qrenderpassfilter.h
index 6d0ff3904..4a707865a 100644
--- a/src/render/framegraph/qrenderpassfilter.h
+++ b/src/render/framegraph/qrenderpassfilter.h
@@ -70,11 +70,9 @@ public:
protected:
QRenderPassFilter(QRenderPassFilterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QRenderPassFilter)
- QT3D_CLONEABLE(QRenderPassFilter)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qrenderstateset.cpp b/src/render/framegraph/qrenderstateset.cpp
index 291b831a5..55c301f3c 100644
--- a/src/render/framegraph/qrenderstateset.cpp
+++ b/src/render/framegraph/qrenderstateset.cpp
@@ -80,20 +80,6 @@ QRenderStateSet::QRenderStateSet(QNode *parent)
{
}
-QRenderStateSet::QRenderStateSet(QRenderStateSetPrivate &dd, QNode *parent)
- : QFrameGraphNode(dd, parent)
-{
-}
-
-void QRenderStateSet::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QRenderStateSet *other = static_cast<const QRenderStateSet*>(ref);
-
- for (QRenderState *renderState : other->d_func()->m_renderStates)
- addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
-}
-
/*!
* Adds a new QRenderState \a state to the QRenderStateSet instance.
*
diff --git a/src/render/framegraph/qrenderstateset.h b/src/render/framegraph/qrenderstateset.h
index 50c631dee..6eeb9977e 100644
--- a/src/render/framegraph/qrenderstateset.h
+++ b/src/render/framegraph/qrenderstateset.h
@@ -62,11 +62,9 @@ public:
protected:
explicit QRenderStateSet(QRenderStateSetPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QRenderStateSet)
- QT3D_CLONEABLE(QRenderStateSet)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qrendersurfaceselector.cpp b/src/render/framegraph/qrendersurfaceselector.cpp
index 37fa26e72..b4bfad22f 100644
--- a/src/render/framegraph/qrendersurfaceselector.cpp
+++ b/src/render/framegraph/qrendersurfaceselector.cpp
@@ -228,18 +228,6 @@ void QRenderSurfaceSelector::setExternalRenderTargetSize(const QSize &size)
emit externalRenderTargetSizeChanged(size);
}
-/*!
- * \internal
- */
-void QRenderSurfaceSelector::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QRenderSurfaceSelector *object = static_cast<const QRenderSurfaceSelector *>(ref);
-
- d_func()->m_surface = object->d_func()->m_surface;
- d_func()->m_externalRenderTargetSize = object->d_func()->m_externalRenderTargetSize;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QRenderSurfaceSelector::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderSurfaceSelectorData>::create(this);
diff --git a/src/render/framegraph/qrendersurfaceselector.h b/src/render/framegraph/qrendersurfaceselector.h
index ee7ec98b1..4f75e82f5 100644
--- a/src/render/framegraph/qrendersurfaceselector.h
+++ b/src/render/framegraph/qrendersurfaceselector.h
@@ -76,10 +76,8 @@ Q_SIGNALS:
protected:
Q_DECLARE_PRIVATE(QRenderSurfaceSelector)
QRenderSurfaceSelector(QRenderSurfaceSelectorPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
- QT3D_CLONEABLE(QRenderSurfaceSelector)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qrendertargetselector.cpp b/src/render/framegraph/qrendertargetselector.cpp
index 0cbe701be..5d5ad6afc 100644
--- a/src/render/framegraph/qrendertargetselector.cpp
+++ b/src/render/framegraph/qrendertargetselector.cpp
@@ -55,17 +55,6 @@ QRenderTargetSelectorPrivate::QRenderTargetSelectorPrivate()
{
}
-void QRenderTargetSelector::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
-
- const QRenderTargetSelector *other = static_cast<const QRenderTargetSelector*>(ref);
-
- setOutputs(other->outputs());
- if (other->d_func()->m_target)
- setTarget(qobject_cast<QRenderTarget *>(QNode::clone(other->d_func()->m_target)));
-}
-
QRenderTargetSelector::QRenderTargetSelector(QNode *parent)
: QFrameGraphNode(*new QRenderTargetSelectorPrivate, parent)
{
diff --git a/src/render/framegraph/qrendertargetselector.h b/src/render/framegraph/qrendertargetselector.h
index 7495ffe20..5b9ceac49 100644
--- a/src/render/framegraph/qrendertargetselector.h
+++ b/src/render/framegraph/qrendertargetselector.h
@@ -72,11 +72,9 @@ Q_SIGNALS:
protected:
QRenderTargetSelector(QRenderTargetSelectorPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QRenderTargetSelector)
- QT3D_CLONEABLE(QRenderTargetSelector)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qsortcriterion.cpp b/src/render/framegraph/qsortcriterion.cpp
index 926f80621..f5252b1f7 100644
--- a/src/render/framegraph/qsortcriterion.cpp
+++ b/src/render/framegraph/qsortcriterion.cpp
@@ -51,13 +51,6 @@ QSortCriterionPrivate::QSortCriterionPrivate()
{
}
-void QSortCriterion::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QSortCriterion *s = static_cast<const QSortCriterion*>(ref);
- d_func()->m_sort = s->d_func()->m_sort;
-}
-
QSortCriterion::QSortCriterion(QNode *parent)
: QNode(*new QSortCriterionPrivate, parent)
{
diff --git a/src/render/framegraph/qsortcriterion.h b/src/render/framegraph/qsortcriterion.h
index 79bfc7187..bf2821550 100644
--- a/src/render/framegraph/qsortcriterion.h
+++ b/src/render/framegraph/qsortcriterion.h
@@ -73,10 +73,8 @@ Q_SIGNALS:
protected:
QSortCriterion(QSortCriterionPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
- QT3D_CLONEABLE(QSortCriterion)
Q_DECLARE_PRIVATE(QSortCriterion)
};
diff --git a/src/render/framegraph/qsortpolicy.cpp b/src/render/framegraph/qsortpolicy.cpp
index 9dbfbbc8c..e89e0f472 100644
--- a/src/render/framegraph/qsortpolicy.cpp
+++ b/src/render/framegraph/qsortpolicy.cpp
@@ -51,14 +51,6 @@ QSortPolicyPrivate::QSortPolicyPrivate()
{
}
-void QSortPolicy::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QSortPolicy *other = static_cast<const QSortPolicy*>(ref);
- Q_FOREACH (const QSortPolicy::SortType c, other->d_func()->m_sortTypes)
- addSortType(c);
-}
-
QSortPolicy::QSortPolicy(QNode *parent)
: QFrameGraphNode(*new QSortPolicyPrivate, parent)
{
@@ -70,6 +62,15 @@ QSortPolicy::QSortPolicy(QSortPolicyPrivate &dd, QNode *parent)
{
}
+QNodeCreatedChangeBasePtr QSortPolicy::createNodeCreationChange() const
+{
+ auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QSortPolicyData>::create(this);
+ QSortPolicyData &data = creationChange->data;
+ Q_D(const QSortPolicy);
+ data.sortTypes = d->m_sortTypes;
+ return creationChange;
+}
+
void QSortPolicy::addSortType(Qt3DRender::QSortPolicy::SortType sortType)
{
Q_D(QSortPolicy);
diff --git a/src/render/framegraph/qsortpolicy.h b/src/render/framegraph/qsortpolicy.h
index 323168fa4..cbe7fe9c2 100644
--- a/src/render/framegraph/qsortpolicy.h
+++ b/src/render/framegraph/qsortpolicy.h
@@ -77,11 +77,10 @@ Q_SIGNALS:
protected:
explicit QSortPolicy(QSortPolicyPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QSortPolicy)
- QT3D_CLONEABLE(QSortPolicy)
+ Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
} // namespace Qt3DRender
diff --git a/src/render/framegraph/qsortpolicy_p.h b/src/render/framegraph/qsortpolicy_p.h
index e84f646da..e9e27408d 100644
--- a/src/render/framegraph/qsortpolicy_p.h
+++ b/src/render/framegraph/qsortpolicy_p.h
@@ -67,6 +67,12 @@ public:
QVector<QSortPolicy::SortType> m_sortTypes;
};
+
+struct QSortPolicyData
+{
+ QVector<QSortPolicy::SortType> sortTypes;
+};
+
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/framegraph/qtechniquefilter.cpp b/src/render/framegraph/qtechniquefilter.cpp
index 3237113b5..7af782537 100644
--- a/src/render/framegraph/qtechniquefilter.cpp
+++ b/src/render/framegraph/qtechniquefilter.cpp
@@ -56,17 +56,6 @@ QTechniqueFilterPrivate::QTechniqueFilterPrivate()
{
}
-void QTechniqueFilter::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QTechniqueFilter *other = static_cast<const QTechniqueFilter*>(ref);
-
- Q_FOREACH (QFilterKey *crit, other->d_func()->m_matchList)
- addMatch(qobject_cast<QFilterKey *>(QNode::clone(crit)));
- for (QParameter *p : other->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-}
-
QTechniqueFilter::QTechniqueFilter(QNode *parent)
: QFrameGraphNode(*new QTechniqueFilterPrivate, parent)
{
diff --git a/src/render/framegraph/qtechniquefilter.h b/src/render/framegraph/qtechniquefilter.h
index b3545b6e5..bc441679e 100644
--- a/src/render/framegraph/qtechniquefilter.h
+++ b/src/render/framegraph/qtechniquefilter.h
@@ -67,11 +67,9 @@ public:
protected:
QTechniqueFilter(QTechniqueFilterPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QTechniqueFilter)
- QT3D_CLONEABLE(QTechniqueFilter)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/qviewport.cpp b/src/render/framegraph/qviewport.cpp
index 43562caa5..2be781279 100644
--- a/src/render/framegraph/qviewport.cpp
+++ b/src/render/framegraph/qviewport.cpp
@@ -52,13 +52,6 @@ QViewportPrivate::QViewportPrivate()
{
}
-void QViewport::copy(const QNode *ref)
-{
- QFrameGraphNode::copy(ref);
- const QViewport *viewport = static_cast<const QViewport*>(ref);
- d_func()->m_normalizedRect = viewport->d_func()->m_normalizedRect;
-}
-
QViewport::QViewport(QNode *parent)
: QFrameGraphNode(*new QViewportPrivate, parent)
{
diff --git a/src/render/framegraph/qviewport.h b/src/render/framegraph/qviewport.h
index 8489b2462..04658737d 100644
--- a/src/render/framegraph/qviewport.h
+++ b/src/render/framegraph/qviewport.h
@@ -68,11 +68,9 @@ Q_SIGNALS:
protected:
QViewport(QViewportPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QViewport)
- QT3D_CLONEABLE(QViewport)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/framegraph/sortpolicy.cpp b/src/render/framegraph/sortpolicy.cpp
index aba272d9d..f04243d6a 100644
--- a/src/render/framegraph/sortpolicy.cpp
+++ b/src/render/framegraph/sortpolicy.cpp
@@ -39,6 +39,7 @@
#include "sortpolicy_p.h"
#include <Qt3DCore/qnodepropertychange.h>
+#include <Qt3DRender/private/qsortpolicy_p.h>
QT_BEGIN_NAMESPACE
@@ -81,6 +82,13 @@ QVector<QSortPolicy::SortType> SortPolicy::sortTypes() const
return m_sortTypes;
}
+void SortPolicy::initializeFromPeer(const QNodeCreatedChangeBasePtr &change)
+{
+ const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QSortPolicyData>>(change);
+ const QSortPolicyData &data = typedChange->data;
+ m_sortTypes = data.sortTypes;
+}
+
} // namepace Render
} // namespace Qt3DRender
diff --git a/src/render/framegraph/sortpolicy_p.h b/src/render/framegraph/sortpolicy_p.h
index b05622555..749965b47 100644
--- a/src/render/framegraph/sortpolicy_p.h
+++ b/src/render/framegraph/sortpolicy_p.h
@@ -71,6 +71,8 @@ public:
QVector<Qt3DRender::QSortPolicy::SortType> sortTypes() const;
private:
+ void initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change) Q_DECL_FINAL;
+
QVector<Qt3DRender::QSortPolicy::SortType> m_sortTypes;
};
diff --git a/src/render/frontend/qboundingvolumedebug.cpp b/src/render/frontend/qboundingvolumedebug.cpp
index cf178f51c..e8ed47ba7 100644
--- a/src/render/frontend/qboundingvolumedebug.cpp
+++ b/src/render/frontend/qboundingvolumedebug.cpp
@@ -110,13 +110,6 @@ bool QBoundingVolumeDebug::recursive() const
return d->m_recursive;
}
-void QBoundingVolumeDebug::copy(const Qt3DCore::QNode *ref)
-{
- QComponent::copy(ref);
- const QBoundingVolumeDebug *debugVolume = static_cast<const QBoundingVolumeDebug *>(ref);
- d_func()->m_recursive = debugVolume->d_func()->m_recursive;
-}
-
void QBoundingVolumeDebug::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QBoundingVolumeDebug);
diff --git a/src/render/frontend/qboundingvolumedebug_p.h b/src/render/frontend/qboundingvolumedebug_p.h
index 05977e9f6..d6b2d8809 100644
--- a/src/render/frontend/qboundingvolumedebug_p.h
+++ b/src/render/frontend/qboundingvolumedebug_p.h
@@ -81,12 +81,12 @@ Q_SIGNALS:
void recursiveChanged(bool recursive);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QBoundingVolumeDebug)
- QT3D_CLONEABLE(QBoundingVolumeDebug)
+
+ // TODO: Handle creation changes
};
} // Qt3DRender
diff --git a/src/render/frontend/qcamera.h b/src/render/frontend/qcamera.h
index 3b82b5a71..812ef5729 100644
--- a/src/render/frontend/qcamera.h
+++ b/src/render/frontend/qcamera.h
@@ -165,7 +165,6 @@ Q_SIGNALS:
protected:
Q_DECLARE_PRIVATE(QCamera)
- QT3D_CLONEABLE(QCamera)
QCamera(QCameraPrivate &dd, QNode *parent = Q_NULLPTR);
};
diff --git a/src/render/frontend/qcameralens.cpp b/src/render/frontend/qcameralens.cpp
index e36fae063..c86610f3d 100644
--- a/src/render/frontend/qcameralens.cpp
+++ b/src/render/frontend/qcameralens.cpp
@@ -68,22 +68,6 @@ QCameraLens::QCameraLens(QNode *parent)
d->updateProjectionMatrix();
}
-void QCameraLens::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QCameraLens *lens = static_cast<const QCameraLens*>(ref);
- d_func()->m_projectionType = lens->d_func()->m_projectionType;
- d_func()->m_nearPlane = lens->d_func()->m_nearPlane;
- d_func()->m_farPlane = lens->d_func()->m_farPlane;
- d_func()->m_fieldOfView = lens->d_func()->m_fieldOfView;
- d_func()->m_aspectRatio = lens->d_func()->m_aspectRatio;
- d_func()->m_left = lens->d_func()->m_left;
- d_func()->m_right = lens->d_func()->m_right;
- d_func()->m_bottom = lens->d_func()->m_bottom;
- d_func()->m_top = lens->d_func()->m_top;
- d_func()->m_projectionMatrix = lens->d_func()->m_projectionMatrix;
-}
-
/*! \class Qt3DRender::QCameraLens
* \inmodule Qt3DCore
*
diff --git a/src/render/frontend/qcameralens.h b/src/render/frontend/qcameralens.h
index 7fba4ac43..846c4557c 100644
--- a/src/render/frontend/qcameralens.h
+++ b/src/render/frontend/qcameralens.h
@@ -127,11 +127,9 @@ Q_SIGNALS:
protected:
QCameraLens(QCameraLensPrivate &dd, QNode *parent = Q_NULLPTR);
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QCameraLens)
- QT3D_CLONEABLE(QCameraLens)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/frontend/qcomputecommand.cpp b/src/render/frontend/qcomputecommand.cpp
index 3a4b67111..41883f76a 100644
--- a/src/render/frontend/qcomputecommand.cpp
+++ b/src/render/frontend/qcomputecommand.cpp
@@ -102,15 +102,6 @@ void QComputeCommand::setWorkGroupZ(int workGroupZ)
}
}
-void QComputeCommand::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QComputeCommand *object = static_cast<const QComputeCommand *>(ref);
- d_func()->m_workGroupX = object->workGroupX();
- d_func()->m_workGroupY = object->workGroupY();
- d_func()->m_workGroupZ = object->workGroupZ();
-}
-
} // Render
QT_END_NAMESPACE
diff --git a/src/render/frontend/qcomputecommand.h b/src/render/frontend/qcomputecommand.h
index 04699ac7a..764e4de33 100644
--- a/src/render/frontend/qcomputecommand.h
+++ b/src/render/frontend/qcomputecommand.h
@@ -74,12 +74,10 @@ Q_SIGNALS:
void workGroupYChanged();
void workGroupZChanged();
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QComputeCommand)
- QT3D_CLONEABLE(QComputeCommand)
+
+ // TODO: Handle creation changes
};
} // Qt3DRender
diff --git a/src/render/frontend/qlayer.cpp b/src/render/frontend/qlayer.cpp
index 8ecf46b1e..b4c85a596 100644
--- a/src/render/frontend/qlayer.cpp
+++ b/src/render/frontend/qlayer.cpp
@@ -65,17 +65,6 @@ QLayerPrivate::QLayerPrivate()
\brief For ...
*/
-
-/*! \fn void Qt3DRender::QLayer::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-void QLayer::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QLayer *layer = static_cast<const QLayer*>(ref);
- d_func()->m_names = layer->d_func()->m_names;
-}
-
/*! \fn Qt3DRender::QLayer::QLayer(Qt3DCore::QNode *parent)
Constructs a new QLayer with the specified \a parent.
*/
diff --git a/src/render/frontend/qlayer.h b/src/render/frontend/qlayer.h
index 13037d711..ad245b60f 100644
--- a/src/render/frontend/qlayer.h
+++ b/src/render/frontend/qlayer.h
@@ -67,11 +67,9 @@ Q_SIGNALS:
protected:
QLayer(QLayerPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QLayer)
- QT3D_CLONEABLE(QLayer)
};
} // namespace Qt3DRender
diff --git a/src/render/frontend/qpickingsettings.cpp b/src/render/frontend/qpickingsettings.cpp
index 705cf150e..abb6115cb 100644
--- a/src/render/frontend/qpickingsettings.cpp
+++ b/src/render/frontend/qpickingsettings.cpp
@@ -93,14 +93,6 @@ void QPickingSettings::setPickResultMode(QPickingSettings::PickResultMode pickRe
emit pickResultModeChanged(pickResultMode);
}
-void QPickingSettings::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QPickingSettings *object = static_cast<const QPickingSettings *>(ref);
- d_func()->m_pickMethod = object->d_func()->m_pickMethod;
- d_func()->m_pickResultMode = object->d_func()->m_pickResultMode;
-}
-
} // namespace Qt3Drender
QT_END_NAMESPACE
diff --git a/src/render/frontend/qpickingsettings.h b/src/render/frontend/qpickingsettings.h
index c87127e3c..985f851a3 100644
--- a/src/render/frontend/qpickingsettings.h
+++ b/src/render/frontend/qpickingsettings.h
@@ -84,10 +84,6 @@ Q_SIGNALS:
protected:
Q_DECLARE_PRIVATE(QPickingSettings)
QPickingSettings(QPickingSettingsPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
-private:
- QT3D_CLONEABLE(QPickingSettings)
};
} // namespace Qt3Drender
diff --git a/src/render/frontend/qrendersettings.cpp b/src/render/frontend/qrendersettings.cpp
index 9d360e9fa..d3d3cba04 100644
--- a/src/render/frontend/qrendersettings.cpp
+++ b/src/render/frontend/qrendersettings.cpp
@@ -125,15 +125,6 @@ void QRenderSettings::setRenderPolicy(QRenderSettings::RenderPolicy renderPolicy
emit renderPolicyChanged(renderPolicy);
}
-void QRenderSettings::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QRenderSettings *object = static_cast<const QRenderSettings *>(ref);
- setActiveFrameGraph(qobject_cast<QFrameGraphNode *>(QNode::clone(object->activeFrameGraph())));
-
- d_func()->m_renderPolicy = object->d_func()->m_renderPolicy;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QRenderSettings::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QRenderSettingsData>::create(this);
diff --git a/src/render/frontend/qrendersettings.h b/src/render/frontend/qrendersettings.h
index 862d91e6b..e9ac4d5dd 100644
--- a/src/render/frontend/qrendersettings.h
+++ b/src/render/frontend/qrendersettings.h
@@ -84,10 +84,8 @@ Q_SIGNALS:
protected:
Q_DECLARE_PRIVATE(QRenderSettings)
QRenderSettings(QRenderSettingsPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
- QT3D_CLONEABLE(QRenderSettings)
Q_PRIVATE_SLOT(d_func(), void _q_onPickingMethodChanged(QPickingSettings::PickMethod))
Q_PRIVATE_SLOT(d_func(), void _q_onPickResultModeChanged(QPickingSettings::PickResultMode))
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
diff --git a/src/render/frontend/qrendertarget.cpp b/src/render/frontend/qrendertarget.cpp
index b947d8494..da2196108 100644
--- a/src/render/frontend/qrendertarget.cpp
+++ b/src/render/frontend/qrendertarget.cpp
@@ -55,14 +55,6 @@ QRenderTargetPrivate::QRenderTargetPrivate()
{
}
-void QRenderTarget::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QRenderTarget *other = static_cast<const QRenderTarget*>(ref);
- for (QRenderTargetOutput *output : other->d_func()->m_outputs)
- addOutput(qobject_cast<QRenderTargetOutput *>(QNode::clone(output)));
-}
-
QRenderTarget::QRenderTarget(QNode *parent)
: QComponent(*new QRenderTargetPrivate, parent)
{
diff --git a/src/render/frontend/qrendertarget.h b/src/render/frontend/qrendertarget.h
index ac011103b..3a21ec611 100644
--- a/src/render/frontend/qrendertarget.h
+++ b/src/render/frontend/qrendertarget.h
@@ -62,11 +62,9 @@ public:
protected:
QRenderTarget(QRenderTargetPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QRenderTarget)
- QT3D_CLONEABLE(QRenderTarget)
};
} // namespace Qt3DRender
diff --git a/src/render/frontend/qrendertargetoutput.cpp b/src/render/frontend/qrendertargetoutput.cpp
index 8a4cb0494..8d1a2f11e 100644
--- a/src/render/frontend/qrendertargetoutput.cpp
+++ b/src/render/frontend/qrendertargetoutput.cpp
@@ -55,14 +55,6 @@ QRenderTargetOutputPrivate::QRenderTargetOutputPrivate()
{
}
-void QRenderTargetOutput::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QRenderTargetOutput *rA = static_cast<const QRenderTargetOutput*>(ref);
- d_func()->m_attachmentPoint = rA->d_func()->m_attachmentPoint;
- setTexture(qobject_cast<QAbstractTexture *>(QNode::clone(rA->d_func()->m_texture)));
-}
-
QRenderTargetOutput::QRenderTargetOutput(QNode *parent)
: QNode(*new QRenderTargetOutputPrivate, parent)
{
diff --git a/src/render/frontend/qrendertargetoutput.h b/src/render/frontend/qrendertargetoutput.h
index baaf8dc1a..a56644028 100644
--- a/src/render/frontend/qrendertargetoutput.h
+++ b/src/render/frontend/qrendertargetoutput.h
@@ -108,11 +108,9 @@ Q_SIGNALS:
protected:
explicit QRenderTargetOutput(QRenderTargetOutputPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QRenderTargetOutput)
- QT3D_CLONEABLE(QRenderTargetOutput)
};
} // namespace Qt3DRender
diff --git a/src/render/geometry/qattribute.cpp b/src/render/geometry/qattribute.cpp
index 1d17b4bc9..e20ede4a6 100644
--- a/src/render/geometry/qattribute.cpp
+++ b/src/render/geometry/qattribute.cpp
@@ -148,25 +148,6 @@ QAttribute::QAttribute(QBuffer *buf, const QString &name, VertexBaseType type, u
d->m_byteStride = stride;
}
-
-/*!
- * \internal
- */
-void QAttribute::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAttribute *attribute = static_cast<const QAttribute *>(ref);
- d_func()->m_buffer = qobject_cast<QBuffer *>(QNode::clone(attribute->d_func()->m_buffer));
- d_func()->m_name = attribute->d_func()->m_name;
- d_func()->m_count = attribute->d_func()->m_count;
- d_func()->m_divisor = attribute->d_func()->m_divisor;
- d_func()->m_byteOffset = attribute->d_func()->m_byteOffset;
- d_func()->m_dataType = attribute->d_func()->m_dataType;
- d_func()->m_dataSize = attribute->d_func()->m_dataSize;
- d_func()->m_byteStride = attribute->d_func()->m_byteStride;
- d_func()->m_attributeType = attribute->d_func()->m_attributeType;
-}
-
/*!
* \property QAttribute::buffer
*
diff --git a/src/render/geometry/qattribute.h b/src/render/geometry/qattribute.h
index 0252d7de5..85a82317a 100644
--- a/src/render/geometry/qattribute.h
+++ b/src/render/geometry/qattribute.h
@@ -129,12 +129,8 @@ Q_SIGNALS:
void divisorChanged(uint divisor);
void attributeTypeChanged(AttributeType attributeType);
-protected:
- void copy(const QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QAttribute)
- QT3D_CLONEABLE(QAttribute)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/geometry/qbuffer.cpp b/src/render/geometry/qbuffer.cpp
index 1c7914fe2..de2589124 100644
--- a/src/render/geometry/qbuffer.cpp
+++ b/src/render/geometry/qbuffer.cpp
@@ -156,20 +156,6 @@ QBuffer::QBuffer(QBuffer::BufferType ty, QNode *parent)
/*!
* \internal
*/
-void QBuffer::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QBuffer *buffer = static_cast<const QBuffer *>(ref);
- d_func()->m_data = buffer->d_func()->m_data;
- d_func()->m_type = buffer->d_func()->m_type;
- d_func()->m_usage = buffer->d_func()->m_usage;
- d_func()->m_functor = buffer->d_func()->m_functor;
- d_func()->m_syncData = buffer->d_func()->m_syncData;
-}
-
-/*!
- * \internal
- */
void QBuffer::sceneChangeEvent(const QSceneChangePtr &change)
{
QNodePropertyChangePtr e = qSharedPointerCast<QNodePropertyChange>(change);
diff --git a/src/render/geometry/qbuffer.h b/src/render/geometry/qbuffer.h
index b9ee3e5c8..edd6055ed 100644
--- a/src/render/geometry/qbuffer.h
+++ b/src/render/geometry/qbuffer.h
@@ -103,7 +103,6 @@ public Q_SLOTS:
void setSyncData(bool syncData);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
Q_SIGNALS:
@@ -114,7 +113,6 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QBuffer)
- QT3D_CLONEABLE(QBuffer)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/geometry/qgeometry.cpp b/src/render/geometry/qgeometry.cpp
index 5399517e5..600cce2fd 100644
--- a/src/render/geometry/qgeometry.cpp
+++ b/src/render/geometry/qgeometry.cpp
@@ -163,20 +163,6 @@ QVector<QAttribute *> QGeometry::attributes() const
return d->m_attributes;
}
-/*!
- * \internal
- */
-void QGeometry::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QGeometry *geometry = static_cast<const QGeometry *>(ref);
- Q_FOREACH (QAttribute *attribute, geometry->d_func()->m_attributes)
- d_func()->m_attributes.append(qobject_cast<QAttribute *>(QNode::clone(attribute)));
- // Copy bounding volume position attribute
- if (geometry->d_func()->m_boundingVolumePositionAttribute != Q_NULLPTR)
- d_func()->m_boundingVolumePositionAttribute = qobject_cast<QAttribute *>(QNode::clone(geometry->d_func()->m_boundingVolumePositionAttribute));
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QGeometry::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QGeometryData>::create(this);
diff --git a/src/render/geometry/qgeometry.h b/src/render/geometry/qgeometry.h
index f35d362a4..a4057ce12 100644
--- a/src/render/geometry/qgeometry.h
+++ b/src/render/geometry/qgeometry.h
@@ -71,11 +71,9 @@ Q_SIGNALS:
protected:
QGeometry(QGeometryPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGeometry)
- QT3D_CLONEABLE(QGeometry)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/geometry/qgeometryrenderer.cpp b/src/render/geometry/qgeometryrenderer.cpp
index aa6d96043..6aad35710 100644
--- a/src/render/geometry/qgeometryrenderer.cpp
+++ b/src/render/geometry/qgeometryrenderer.cpp
@@ -404,37 +404,19 @@ void QGeometryRenderer::setGeometryFactory(const QGeometryFactoryPtr &factory)
/*!
* \internal
*/
-void QGeometryRenderer::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QGeometryRenderer *other = static_cast<const QGeometryRenderer *>(ref);
- d_func()->m_instanceCount = other->d_func()->m_instanceCount;
- d_func()->m_vertexCount = other->d_func()->m_vertexCount;
- d_func()->m_indexOffset = other->d_func()->m_indexOffset;
- d_func()->m_firstInstance = other->d_func()->m_firstInstance;
- d_func()->m_restartIndexValue = other->d_func()->m_restartIndexValue;
- d_func()->m_primitiveRestart = other->d_func()->m_primitiveRestart;
- d_func()->m_primitiveType = other->d_func()->m_primitiveType;
- d_func()->m_verticesPerPatch = other->d_func()->m_verticesPerPatch;
- d_func()->m_geometry = static_cast<QGeometry *>(QNode::clone(other->d_func()->m_geometry));
- d_func()->m_geometryFactory = other->d_func()->m_geometryFactory;
-}
-
-/*!
- * \internal
- */
void QGeometryRenderer::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
{
- Q_D(QGeometryRenderer);
- QNodePropertyChangePtr change = qSharedPointerCast<QNodePropertyChange>(e);
- if (change->type() == NodeUpdated && change->propertyName() == QByteArrayLiteral("geometry")) {
- QNodePtr nodePtr = change->value().value<QNodePtr>();
- QGeometry *backendGeometry = static_cast<QGeometry *>(nodePtr.data());
- QGeometry *frontendGeometry = static_cast<QGeometry *>(QNode::clone(backendGeometry));
- if (frontendGeometry != Q_NULLPTR)
- d->insertTree(frontendGeometry);
- setGeometry(frontendGeometry);
- }
+ // TODO: Avoid cloning here
+// Q_D(QGeometryRenderer);
+// QScenePropertyChangePtr change = qSharedPointerCast<QScenePropertyChange>(e);
+// if (change->type() == NodeUpdated && change->propertyName() == QByteArrayLiteral("geometry")) {
+// QNodePtr nodePtr = change->value().value<QNodePtr>();
+// QGeometry *backendGeometry = static_cast<QGeometry *>(nodePtr.data());
+// QGeometry *frontendGeometry = static_cast<QGeometry *>(QNode::clone(backendGeometry));
+// if (frontendGeometry != Q_NULLPTR)
+// d->insertTree(frontendGeometry);
+// setGeometry(frontendGeometry);
+// }
}
Qt3DCore::QNodeCreatedChangeBasePtr QGeometryRenderer::createNodeCreationChange() const
diff --git a/src/render/geometry/qgeometryrenderer.h b/src/render/geometry/qgeometryrenderer.h
index 6aab5a1c2..55fdcf93c 100644
--- a/src/render/geometry/qgeometryrenderer.h
+++ b/src/render/geometry/qgeometryrenderer.h
@@ -125,12 +125,10 @@ Q_SIGNALS:
protected:
QGeometryRenderer(QGeometryRendererPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QGeometryRenderer)
- QT3D_CLONEABLE(QGeometryRenderer)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/io/qsceneloader.cpp b/src/render/io/qsceneloader.cpp
index 09ce56f47..19bec1fba 100644
--- a/src/render/io/qsceneloader.cpp
+++ b/src/render/io/qsceneloader.cpp
@@ -101,13 +101,6 @@ void QSceneLoader::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
}
}
-void QSceneLoader::copy(const QNode *ref)
-{
- Qt3DCore::QComponent::copy(ref);
- const QSceneLoader *s = static_cast<const QSceneLoader*>(ref);
- d_func()->m_source = s->d_func()->m_source;
-}
-
QUrl QSceneLoader::source() const
{
Q_D(const QSceneLoader);
diff --git a/src/render/io/qsceneloader.h b/src/render/io/qsceneloader.h
index 005b54f49..1cdc03da3 100644
--- a/src/render/io/qsceneloader.h
+++ b/src/render/io/qsceneloader.h
@@ -80,9 +80,7 @@ Q_SIGNALS:
void statusChanged(Status status);
protected:
- QT3D_CLONEABLE(QSceneLoader)
explicit QSceneLoader(QSceneLoaderPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QSceneLoader)
diff --git a/src/render/lights/qabstractlight.cpp b/src/render/lights/qabstractlight.cpp
index 1b4f3c199..767ce9031 100644
--- a/src/render/lights/qabstractlight.cpp
+++ b/src/render/lights/qabstractlight.cpp
@@ -61,14 +61,6 @@ QAbstractLightPrivate::QAbstractLightPrivate(QAbstractLight::Type type)
m_shaderData->setProperty("type", type);
}
-void QAbstractLight::copy(const QNode *ref)
-{
- const QAbstractLight *light = static_cast<const QAbstractLight*>(ref);
- d_func()->m_type = light->d_func()->m_type;
- d_func()->m_shaderData = qobject_cast<QShaderData *>(QNode::clone(light->d_func()->m_shaderData));
- QComponent::copy(ref);
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QAbstractLight::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QAbstractLightData>::create(this);
diff --git a/src/render/lights/qabstractlight.h b/src/render/lights/qabstractlight.h
index 0a8593066..29c4eece1 100644
--- a/src/render/lights/qabstractlight.h
+++ b/src/render/lights/qabstractlight.h
@@ -77,7 +77,7 @@ public Q_SLOTS:
protected :
QAbstractLight(QAbstractLightPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
+
Q_SIGNALS:
void colorChanged(const QColor &color);
diff --git a/src/render/lights/qdirectionallight.cpp b/src/render/lights/qdirectionallight.cpp
index d53d86aa7..98a98e801 100644
--- a/src/render/lights/qdirectionallight.cpp
+++ b/src/render/lights/qdirectionallight.cpp
@@ -70,11 +70,6 @@ QDirectionalLightPrivate::QDirectionalLightPrivate()
m_shaderData->setProperty("direction", QVector3D(0.0f, -1.0f, 0.0f));
}
-void QDirectionalLight::copy(const QNode *ref)
-{
- QAbstractLight::copy(ref);
-}
-
QDirectionalLight::QDirectionalLight(QNode *parent)
: QAbstractLight(*new QDirectionalLightPrivate, parent)
{
diff --git a/src/render/lights/qdirectionallight.h b/src/render/lights/qdirectionallight.h
index ec2e960db..79ad7c663 100644
--- a/src/render/lights/qdirectionallight.h
+++ b/src/render/lights/qdirectionallight.h
@@ -66,11 +66,9 @@ Q_SIGNALS:
protected:
QDirectionalLight(QDirectionalLightPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QDirectionalLight)
- QT3D_CLONEABLE(QDirectionalLight)
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qpointlight.h b/src/render/lights/qpointlight.h
index 972a19b20..6f975f07b 100644
--- a/src/render/lights/qpointlight.h
+++ b/src/render/lights/qpointlight.h
@@ -75,7 +75,6 @@ Q_SIGNALS:
protected:
Q_DECLARE_PRIVATE(QPointLight)
QPointLight(QPointLightPrivate &dd, Qt3DCore::QNode *parent);
- QT3D_CLONEABLE(QPointLight)
};
} // namespace Qt3DRender
diff --git a/src/render/lights/qspotlight.cpp b/src/render/lights/qspotlight.cpp
index 711fb790c..7a510b89d 100644
--- a/src/render/lights/qspotlight.cpp
+++ b/src/render/lights/qspotlight.cpp
@@ -91,16 +91,6 @@ QSpotLightPrivate::QSpotLightPrivate()
\brief For OpenGL ...
*/
-/*! \fn void Qt3DRender::QSpotLight::copy(const Qt3DCore::QNode *ref)
- Copies the \a ref instance into this one.
- */
-
-void QSpotLight::copy(const QNode *ref)
-{
- QAbstractLight::copy(ref);
-}
-
-
/*!
\fn Qt3DRender::QSpotLight::QSpotLight(Qt3DCore::QNode *parent)
Constructs a new QSpotLight with the specified \a parent.
diff --git a/src/render/lights/qspotlight.h b/src/render/lights/qspotlight.h
index 3d7889156..d66aa2719 100644
--- a/src/render/lights/qspotlight.h
+++ b/src/render/lights/qspotlight.h
@@ -84,11 +84,9 @@ Q_SIGNALS:
protected:
QSpotLight(QSpotLightPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QSpotLight)
- QT3D_CLONEABLE(QSpotLight)
};
} // namespace Qt3DRender
diff --git a/src/render/materialsystem/qeffect.cpp b/src/render/materialsystem/qeffect.cpp
index 31a74c53b..fd6ed985f 100644
--- a/src/render/materialsystem/qeffect.cpp
+++ b/src/render/materialsystem/qeffect.cpp
@@ -62,17 +62,6 @@ QEffect::QEffect(QNode *parent)
{
}
-void QEffect::copy(const QNode* ref)
-{
- QNode::copy(ref);
- const QEffect *effect = static_cast<const QEffect*>(ref);
- Q_FOREACH (QParameter *p, effect->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-
- Q_FOREACH (QTechnique *t, effect->d_func()->m_techniques)
- addTechnique(qobject_cast<QTechnique *>(QNode::clone(t)));
-}
-
/*! \internal */
QEffect::QEffect(QEffectPrivate &dd, QNode *parent)
: QNode(dd, parent)
diff --git a/src/render/materialsystem/qeffect.h b/src/render/materialsystem/qeffect.h
index 54e18454c..b5a12f575 100644
--- a/src/render/materialsystem/qeffect.h
+++ b/src/render/materialsystem/qeffect.h
@@ -67,11 +67,9 @@ public:
protected:
QEffect(QEffectPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QEffect)
- QT3D_CLONEABLE(QEffect)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qfilterkey.cpp b/src/render/materialsystem/qfilterkey.cpp
index 332000db2..135dc9c46 100644
--- a/src/render/materialsystem/qfilterkey.cpp
+++ b/src/render/materialsystem/qfilterkey.cpp
@@ -69,17 +69,6 @@ QFilterKeyPrivate::QFilterKeyPrivate()
*/
/*!
- Copies the annotation in \a ref into this annotation.
- */
-void QFilterKey::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QFilterKey *criterion = static_cast<const QFilterKey*>(ref);
- d_func()->m_name = criterion->d_func()->m_name;
- d_func()->m_value = criterion->d_func()->m_value;
-}
-
-/*!
The constructor creats a new annotation under \a parent.
*/
QFilterKey::QFilterKey(QNode *parent)
diff --git a/src/render/materialsystem/qfilterkey.h b/src/render/materialsystem/qfilterkey.h
index 5bcd81a11..e0a2ecb10 100644
--- a/src/render/materialsystem/qfilterkey.h
+++ b/src/render/materialsystem/qfilterkey.h
@@ -69,12 +69,8 @@ Q_SIGNALS:
void nameChanged(const QString &name);
void valueChanged(const QVariant &value);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QFilterKey)
- QT3D_CLONEABLE(QFilterKey)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qmaterial.cpp b/src/render/materialsystem/qmaterial.cpp
index 93518f602..3a1e75117 100644
--- a/src/render/materialsystem/qmaterial.cpp
+++ b/src/render/materialsystem/qmaterial.cpp
@@ -84,19 +84,6 @@ QMaterialPrivate::QMaterialPrivate()
{
}
-void QMaterial::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QMaterial *material = static_cast<const QMaterial*>(ref);
- Q_FOREACH (QParameter *p, material->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-
- // TO DO: We may want to copy the node id of the effect and only send a clone
- // when we are the parent of the effect
- if (material->d_func()->m_effect && material->d_func()->m_effect->parent() == ref)
- setEffect(qobject_cast<QEffect *>(QNode::clone(material->d_func()->m_effect)));
-}
-
QMaterial::QMaterial(QNode *parent)
: QComponent(*new QMaterialPrivate, parent)
{
diff --git a/src/render/materialsystem/qmaterial.h b/src/render/materialsystem/qmaterial.h
index b97f11b90..06df54a4d 100644
--- a/src/render/materialsystem/qmaterial.h
+++ b/src/render/materialsystem/qmaterial.h
@@ -76,11 +76,9 @@ Q_SIGNALS:
protected:
QMaterial(QMaterialPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QMaterial)
- QT3D_CLONEABLE(QMaterial)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qparameter.cpp b/src/render/materialsystem/qparameter.cpp
index c4bea633b..8d05290aa 100644
--- a/src/render/materialsystem/qparameter.cpp
+++ b/src/render/materialsystem/qparameter.cpp
@@ -64,15 +64,6 @@ void QParameterPrivate::setValue(const QVariant &v)
m_value = v;
}
-void QParameter::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QParameter *param = static_cast<const QParameter*>(ref);
- d_func()->m_name = param->d_func()->m_name;
- d_func()->m_value = param->d_func()->m_value;
- d_func()->m_backendValue = param->d_func()->m_backendValue;
-}
-
/*! \internal */
QParameter::QParameter(QParameterPrivate &dd, QNode *parent)
: QNode(dd, parent)
diff --git a/src/render/materialsystem/qparameter.h b/src/render/materialsystem/qparameter.h
index 1ec5bc556..590bfc166 100644
--- a/src/render/materialsystem/qparameter.h
+++ b/src/render/materialsystem/qparameter.h
@@ -75,11 +75,9 @@ Q_SIGNALS:
protected:
QParameter(QParameterPrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QParameter)
- QT3D_CLONEABLE(QParameter)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qrenderpass.cpp b/src/render/materialsystem/qrenderpass.cpp
index c0191512a..d3ad56623 100644
--- a/src/render/materialsystem/qrenderpass.cpp
+++ b/src/render/materialsystem/qrenderpass.cpp
@@ -60,20 +60,6 @@ QRenderPassPrivate::QRenderPassPrivate()
{
}
-void QRenderPass::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QRenderPass *other = static_cast<const QRenderPass*>(ref);
- d_func()->m_shader = qobject_cast<QShaderProgram *>(QNode::clone(other->d_func()->m_shader));
-
- Q_FOREACH (QFilterKey *crit, other->d_func()->m_filterKeyList)
- addFilterKey(qobject_cast<QFilterKey *>(QNode::clone(crit)));
- Q_FOREACH (QRenderState *renderState, other->d_func()->m_renderStates)
- addRenderState(qobject_cast<QRenderState *>(QNode::clone(renderState)));
- Q_FOREACH (QParameter *p, other->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-}
-
QRenderPass::QRenderPass(QNode *parent)
: QNode(*new QRenderPassPrivate, parent)
{
diff --git a/src/render/materialsystem/qrenderpass.h b/src/render/materialsystem/qrenderpass.h
index 971f01eee..def35fef7 100644
--- a/src/render/materialsystem/qrenderpass.h
+++ b/src/render/materialsystem/qrenderpass.h
@@ -89,11 +89,9 @@ Q_SIGNALS:
protected:
QRenderPass(QRenderPassPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QRenderPass)
- QT3D_CLONEABLE(QRenderPass)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qshaderdata.cpp b/src/render/materialsystem/qshaderdata.cpp
index e19c28b73..062b28549 100644
--- a/src/render/materialsystem/qshaderdata.cpp
+++ b/src/render/materialsystem/qshaderdata.cpp
@@ -88,32 +88,6 @@ QShaderData::QShaderData(QShaderDataPrivate &dd, QNode *parent)
{
}
-void QShaderData::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QShaderData *shaderData = static_cast<const QShaderData *>(ref);
- // We need to copy the properties
- // At the moment we assume that the properties are copyable
- // this may change in a later refactoring
-
- const QMetaObject *metaObject = shaderData->metaObject();
- const int propertyOffset = QShaderData::staticMetaObject.propertyOffset();
- const int propertyCount = metaObject->propertyCount();
-
- // Copy properties of shaderData
- for (int i = propertyOffset; i < propertyCount; ++i) {
- const QMetaProperty property = metaObject->property(i);
- if (property.isWritable()) {
- setProperty(property.name(), propertyReader()->readProperty(shaderData->property(property.name())));
- }
- }
-
- // Also copy the dynamic properties
- foreach (const QByteArray &propertyName, shaderData->dynamicPropertyNames()) {
- setProperty(propertyName, propertyReader()->readProperty(shaderData->property(propertyName)));
- }
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QShaderData::createNodeCreationChange() const
{
auto creationChange = Qt3DCore::QNodeCreatedChangePtr<QShaderDataData>::create(this);
diff --git a/src/render/materialsystem/qshaderdata.h b/src/render/materialsystem/qshaderdata.h
index 325948fba..7c74c58d7 100644
--- a/src/render/materialsystem/qshaderdata.h
+++ b/src/render/materialsystem/qshaderdata.h
@@ -75,12 +75,9 @@ public:
protected:
QShaderData(QShaderDataPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QShaderData)
- QT3D_CLONEABLE(QShaderData)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qshaderprogram.cpp b/src/render/materialsystem/qshaderprogram.cpp
index 612e89bdd..4c7d99e15 100644
--- a/src/render/materialsystem/qshaderprogram.cpp
+++ b/src/render/materialsystem/qshaderprogram.cpp
@@ -55,19 +55,6 @@ QShaderProgramPrivate::QShaderProgramPrivate()
{
}
-void QShaderProgram::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QShaderProgram *prog = static_cast<const QShaderProgram*>(ref);
-
- d_func()->m_vertexShaderCode = prog->d_func()->m_vertexShaderCode;
- d_func()->m_tessControlShaderCode = prog->d_func()->m_tessControlShaderCode;
- d_func()->m_tessEvalShaderCode = prog->d_func()->m_tessEvalShaderCode;
- d_func()->m_geometryShaderCode = prog->d_func()->m_geometryShaderCode;
- d_func()->m_fragmentShaderCode = prog->d_func()->m_fragmentShaderCode;
- d_func()->m_computeShaderCode = prog->d_func()->m_computeShaderCode;
-}
-
QShaderProgram::QShaderProgram(QNode *parent)
: QNode(*new QShaderProgramPrivate, parent)
{
diff --git a/src/render/materialsystem/qshaderprogram.h b/src/render/materialsystem/qshaderprogram.h
index 3e88c1f4c..82b0a686e 100644
--- a/src/render/materialsystem/qshaderprogram.h
+++ b/src/render/materialsystem/qshaderprogram.h
@@ -103,11 +103,9 @@ Q_SIGNALS:
protected:
QShaderProgram(QShaderProgramPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QShaderProgram)
- QT3D_CLONEABLE(QShaderProgram)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/materialsystem/qtechnique.cpp b/src/render/materialsystem/qtechnique.cpp
index 659350a2f..7353fbe2d 100644
--- a/src/render/materialsystem/qtechnique.cpp
+++ b/src/render/materialsystem/qtechnique.cpp
@@ -75,21 +75,6 @@ QTechnique::QTechnique(QTechniquePrivate &dd, QNode *parent)
QObject::connect(&d->m_graphicsApiFilter, SIGNAL(graphicsApiFilterChanged()), this, SLOT(_q_graphicsApiFilterChanged()));
}
-void QTechnique::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QTechnique *tech = static_cast<const QTechnique*>(ref);
- QGraphicsApiFilterPrivate::get(const_cast<QGraphicsApiFilter *>(&d_func()->m_graphicsApiFilter))->m_data =
- QGraphicsApiFilterPrivate::get(const_cast<QGraphicsApiFilter *>(&tech->d_func()->m_graphicsApiFilter))->m_data;
-
- Q_FOREACH (QFilterKey *annotation, tech->d_func()->m_filterKeys)
- addFilterKey(qobject_cast<QFilterKey *>(QNode::clone(annotation)));
- Q_FOREACH (QRenderPass *pass, tech->d_func()->m_renderPasses)
- addRenderPass(qobject_cast<QRenderPass *>(QNode::clone(pass)));
- Q_FOREACH (QParameter *p, tech->d_func()->m_parameters)
- addParameter(qobject_cast<QParameter *>(QNode::clone(p)));
-}
-
void QTechniquePrivate::_q_graphicsApiFilterChanged()
{
if (m_changeArbiter != Q_NULLPTR) {
diff --git a/src/render/materialsystem/qtechnique.h b/src/render/materialsystem/qtechnique.h
index 737bbd005..d9f7a1fb1 100644
--- a/src/render/materialsystem/qtechnique.h
+++ b/src/render/materialsystem/qtechnique.h
@@ -79,11 +79,9 @@ public:
protected:
QTechnique(QTechniquePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(QTechnique)
- QT3D_CLONEABLE(QTechnique)
Q_PRIVATE_SLOT(d_func(), void _q_graphicsApiFilterChanged())
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/picking/qobjectpicker.cpp b/src/render/picking/qobjectpicker.cpp
index 111332fda..3f2af9694 100644
--- a/src/render/picking/qobjectpicker.cpp
+++ b/src/render/picking/qobjectpicker.cpp
@@ -186,14 +186,6 @@ bool QObjectPicker::isPressed() const
return d->m_pressed;
}
-void QObjectPicker::copy(const QNode *ref)
-{
- QComponent::copy(ref);
- const QObjectPicker *picker = static_cast<const QObjectPicker *>(ref);
- d_func()->m_hoverEnabled = picker->d_func()->m_hoverEnabled;
- d_func()->m_dragEnabled = picker->d_func()->m_dragEnabled;
-}
-
void QObjectPicker::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
{
Q_D(QObjectPicker);
diff --git a/src/render/picking/qobjectpicker.h b/src/render/picking/qobjectpicker.h
index cddb731b8..607d332ba 100644
--- a/src/render/picking/qobjectpicker.h
+++ b/src/render/picking/qobjectpicker.h
@@ -85,12 +85,12 @@ Q_SIGNALS:
void containsMouseChanged(bool containsMouse);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
private:
- QT3D_CLONEABLE(QObjectPicker)
Q_DECLARE_PRIVATE(QObjectPicker)
+
+ // TODO: Handle creation changes
};
} // Qt3D
diff --git a/src/render/renderstates/qalphacoverage.h b/src/render/renderstates/qalphacoverage.h
index 885bc8651..f488fe520 100644
--- a/src/render/renderstates/qalphacoverage.h
+++ b/src/render/renderstates/qalphacoverage.h
@@ -57,7 +57,6 @@ public:
private:
Q_DECLARE_PRIVATE(QAlphaCoverage)
- QT3D_CLONEABLE(QAlphaCoverage)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qalphatest.cpp b/src/render/renderstates/qalphatest.cpp
index f0e29cec1..d6b4d03b7 100644
--- a/src/render/renderstates/qalphatest.cpp
+++ b/src/render/renderstates/qalphatest.cpp
@@ -51,14 +51,6 @@ QAlphaTest::QAlphaTest(QNode *parent)
{
}
-void QAlphaTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QAlphaTest *refState = static_cast<const QAlphaTest*>(ref);
- d_func()->m_alphaFunction = refState->d_func()->m_alphaFunction;
- d_func()->m_referenceValue = refState->d_func()->m_referenceValue;
-}
-
QAlphaTest::AlphaFunction QAlphaTest::alphaFunction() const
{
Q_D(const QAlphaTest);
diff --git a/src/render/renderstates/qalphatest.h b/src/render/renderstates/qalphatest.h
index df8e4a4e9..2807cef79 100644
--- a/src/render/renderstates/qalphatest.h
+++ b/src/render/renderstates/qalphatest.h
@@ -81,12 +81,8 @@ Q_SIGNALS:
void alphaFunctionChanged(AlphaFunction alphaFunction);
void referenceValueChanged(float referenceValue);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QAlphaTest)
- QT3D_CLONEABLE(QAlphaTest)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qblendequation.cpp b/src/render/renderstates/qblendequation.cpp
index d805062a9..5062b157d 100644
--- a/src/render/renderstates/qblendequation.cpp
+++ b/src/render/renderstates/qblendequation.cpp
@@ -46,13 +46,6 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-void QBlendEquation::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QBlendEquation *refState = reinterpret_cast<const QBlendEquation*>(ref);
- d_func()->m_blendFunction = refState->d_func()->m_blendFunction;
-}
-
QBlendEquation::QBlendEquation(QNode *parent)
: QRenderState(*new QBlendEquationPrivate, parent)
{
diff --git a/src/render/renderstates/qblendequation.h b/src/render/renderstates/qblendequation.h
index cde1b07c3..5165ce90a 100644
--- a/src/render/renderstates/qblendequation.h
+++ b/src/render/renderstates/qblendequation.h
@@ -75,12 +75,8 @@ public Q_SLOTS:
Q_SIGNALS:
void blendFunctionChanged(BlendFunction blendFunction);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QBlendEquation)
- QT3D_CLONEABLE(QBlendEquation)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qblendequationarguments.cpp b/src/render/renderstates/qblendequationarguments.cpp
index 03e0bf68f..7983b9c0a 100644
--- a/src/render/renderstates/qblendequationarguments.cpp
+++ b/src/render/renderstates/qblendequationarguments.cpp
@@ -83,21 +83,6 @@ QBlendEquationArguments::QBlendEquationArguments(QNode *parent)
{
}
-/*! \fn void QBlendEquationArguments::copy(const Qt3DCore::QNode *ref)
- \internal
- Copies \a ref into this object.
- */
-void QBlendEquationArguments::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QBlendEquationArguments *refState = static_cast<const QBlendEquationArguments*>(ref);
- d_func()->m_sourceRgb = refState->d_func()->m_sourceRgb;
- d_func()->m_sourceAlpha = refState->d_func()->m_sourceAlpha;
- d_func()->m_destinationAlpha = refState->d_func()->m_destinationAlpha;
- d_func()->m_destinationRgb = refState->d_func()->m_destinationRgb;
- d_func()->m_bufferIndex = refState->d_func()->m_bufferIndex;
-}
-
/*!
\internal
*/
diff --git a/src/render/renderstates/qblendequationarguments.h b/src/render/renderstates/qblendequationarguments.h
index d4994c1a6..47b14bde1 100644
--- a/src/render/renderstates/qblendequationarguments.h
+++ b/src/render/renderstates/qblendequationarguments.h
@@ -112,12 +112,10 @@ Q_SIGNALS:
void bufferIndexChanged(int index);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
QBlendEquationArguments(QBlendEquationArgumentsPrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
private:
Q_DECLARE_PRIVATE(QBlendEquationArguments)
- QT3D_CLONEABLE(QBlendEquationArguments)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qclipplane.cpp b/src/render/renderstates/qclipplane.cpp
index 14b3e4aba..2deab3bf1 100644
--- a/src/render/renderstates/qclipplane.cpp
+++ b/src/render/renderstates/qclipplane.cpp
@@ -131,15 +131,6 @@ void QClipPlane::setDistance(float distance)
}
}
-void QClipPlane::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QClipPlane *refClip = static_cast<const QClipPlane *>(ref);
- d_func()->m_planeIndex = refClip->planeIndex();
- d_func()->m_normal = refClip->normal();
- d_func()->m_distance = refClip->distance();
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QClipPlane::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QClipPlaneData>::create(this);
diff --git a/src/render/renderstates/qclipplane.h b/src/render/renderstates/qclipplane.h
index 0e5489871..c0a951427 100644
--- a/src/render/renderstates/qclipplane.h
+++ b/src/render/renderstates/qclipplane.h
@@ -67,9 +67,6 @@ public Q_SLOTS:
void setNormal(QVector3D);
void setDistance(float);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
Q_SIGNALS:
void planeIndexChanged(int planeIndex);
void normalChanged(QVector3D normal);
@@ -77,7 +74,6 @@ Q_SIGNALS:
private:
Q_DECLARE_PRIVATE(QClipPlane)
- QT3D_CLONEABLE(QClipPlane)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qcolormask.cpp b/src/render/renderstates/qcolormask.cpp
index c9677154e..da231dc2d 100644
--- a/src/render/renderstates/qcolormask.cpp
+++ b/src/render/renderstates/qcolormask.cpp
@@ -143,16 +143,6 @@ void QColorMask::setAlphaMasked(bool alphaMasked)
}
}
-void QColorMask::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QColorMask *refState = static_cast<const QColorMask *>(ref);
- d_func()->m_redMasked = refState->d_func()->m_redMasked;
- d_func()->m_greenMasked = refState->d_func()->m_greenMasked;
- d_func()->m_blueMasked = refState->d_func()->m_blueMasked;
- d_func()->m_alphaMasked = refState->d_func()->m_alphaMasked;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QColorMask::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QColorMaskData>::create(this);
diff --git a/src/render/renderstates/qcolormask.h b/src/render/renderstates/qcolormask.h
index 042a07b71..bd59cc85d 100644
--- a/src/render/renderstates/qcolormask.h
+++ b/src/render/renderstates/qcolormask.h
@@ -76,12 +76,8 @@ Q_SIGNALS:
void blueMaskedChanged(bool blueMasked);
void alphaMaskedChanged(bool alphaMasked);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
private:
Q_DECLARE_PRIVATE(QColorMask)
- QT3D_CLONEABLE(QColorMask)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qcullface.cpp b/src/render/renderstates/qcullface.cpp
index cb7dc3f28..cebb55761 100644
--- a/src/render/renderstates/qcullface.cpp
+++ b/src/render/renderstates/qcullface.cpp
@@ -51,13 +51,6 @@ QCullFace::QCullFace(QNode *parent)
{
}
-void QCullFace::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QCullFace *refState = static_cast<const QCullFace*>(ref);
- d_func()->m_mode = refState->d_func()->m_mode;
-}
-
QCullFace::CullingMode QCullFace::mode() const
{
Q_D(const QCullFace);
diff --git a/src/render/renderstates/qcullface.h b/src/render/renderstates/qcullface.h
index cc766d32d..acdb0336a 100644
--- a/src/render/renderstates/qcullface.h
+++ b/src/render/renderstates/qcullface.h
@@ -76,12 +76,8 @@ public Q_SLOTS:
Q_SIGNALS:
void modeChanged(CullingMode mode);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QCullFace)
- QT3D_CLONEABLE(QCullFace)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qdepthtest.cpp b/src/render/renderstates/qdepthtest.cpp
index c8348e161..00207c824 100644
--- a/src/render/renderstates/qdepthtest.cpp
+++ b/src/render/renderstates/qdepthtest.cpp
@@ -46,13 +46,6 @@ QT_BEGIN_NAMESPACE
namespace Qt3DRender {
-void QDepthTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QDepthTest *refState = static_cast<const QDepthTest*>(ref);
- d_func()->m_depthFunction = refState->d_func()->m_depthFunction;
-}
-
QDepthTest::QDepthTest(QNode *parent)
: QRenderState(*new QDepthTestPrivate, parent)
{
diff --git a/src/render/renderstates/qdepthtest.h b/src/render/renderstates/qdepthtest.h
index d6b57e95b..322170f9e 100644
--- a/src/render/renderstates/qdepthtest.h
+++ b/src/render/renderstates/qdepthtest.h
@@ -77,12 +77,8 @@ public Q_SLOTS:
Q_SIGNALS:
void depthFunctionChanged(DepthFunction depthFunction);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QDepthTest)
- QT3D_CLONEABLE(QDepthTest)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qdithering.h b/src/render/renderstates/qdithering.h
index aae5aa1e5..f151790a8 100644
--- a/src/render/renderstates/qdithering.h
+++ b/src/render/renderstates/qdithering.h
@@ -57,7 +57,6 @@ public:
private:
Q_DECLARE_PRIVATE(QDithering)
- QT3D_CLONEABLE(QDithering)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qfrontface.cpp b/src/render/renderstates/qfrontface.cpp
index 300626a63..e5efcb882 100644
--- a/src/render/renderstates/qfrontface.cpp
+++ b/src/render/renderstates/qfrontface.cpp
@@ -51,13 +51,6 @@ QFrontFace::QFrontFace(QNode *parent)
{
}
-void QFrontFace::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QFrontFace *refState = static_cast<const QFrontFace*>(ref);
- d_func()->m_direction = refState->d_func()->m_direction;
-}
-
QFrontFace::WindingDirection QFrontFace::direction() const
{
Q_D(const QFrontFace);
diff --git a/src/render/renderstates/qfrontface.h b/src/render/renderstates/qfrontface.h
index 02bbbb67d..c2441c270 100644
--- a/src/render/renderstates/qfrontface.h
+++ b/src/render/renderstates/qfrontface.h
@@ -72,12 +72,8 @@ public Q_SLOTS:
Q_SIGNALS:
void directionChanged(WindingDirection direction);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QFrontFace)
- QT3D_CLONEABLE(QFrontFace)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qmultisampleantialiasing.h b/src/render/renderstates/qmultisampleantialiasing.h
index 8393a38ab..fa672189b 100644
--- a/src/render/renderstates/qmultisampleantialiasing.h
+++ b/src/render/renderstates/qmultisampleantialiasing.h
@@ -57,7 +57,6 @@ public:
private:
Q_DECLARE_PRIVATE(QMultiSampleAntiAliasing)
- QT3D_CLONEABLE(QMultiSampleAntiAliasing)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qnodepthmask.h b/src/render/renderstates/qnodepthmask.h
index d4fa653fa..6e7c4b8fa 100644
--- a/src/render/renderstates/qnodepthmask.h
+++ b/src/render/renderstates/qnodepthmask.h
@@ -57,7 +57,6 @@ public:
private:
Q_DECLARE_PRIVATE(QNoDepthMask)
- QT3D_CLONEABLE(QNoDepthMask)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qpointsize.cpp b/src/render/renderstates/qpointsize.cpp
index c3fa6e3ee..908940e0f 100644
--- a/src/render/renderstates/qpointsize.cpp
+++ b/src/render/renderstates/qpointsize.cpp
@@ -87,17 +87,6 @@ void QPointSize::setValue(float size)
emit valueChanged(size);
}
-void QPointSize::copy(const Qt3DCore::QNode *ref)
-{
- const QPointSize *refState = static_cast<const QPointSize *>(ref);
-
- QRenderState::copy(ref);
-
- Q_D(QPointSize);
- d->m_value = refState->d_func()->m_value;
- d->m_sizeMode = refState->d_func()->m_sizeMode;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QPointSize::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QPointSizeData>::create(this);
diff --git a/src/render/renderstates/qpointsize.h b/src/render/renderstates/qpointsize.h
index 66628a694..3ba3c7f3a 100644
--- a/src/render/renderstates/qpointsize.h
+++ b/src/render/renderstates/qpointsize.h
@@ -73,12 +73,8 @@ Q_SIGNALS:
void sizeModeChanged(SizeMode sizeMode);
void valueChanged(float value);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
private:
Q_DECLARE_PRIVATE(QPointSize)
- QT3D_CLONEABLE(QPointSize)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qpolygonoffset.cpp b/src/render/renderstates/qpolygonoffset.cpp
index 590c434db..edada68ae 100644
--- a/src/render/renderstates/qpolygonoffset.cpp
+++ b/src/render/renderstates/qpolygonoffset.cpp
@@ -80,14 +80,6 @@ void QPolygonOffset::setDepthSteps(float depthSteps)
}
}
-void QPolygonOffset::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QPolygonOffset *refState = static_cast<const QPolygonOffset *>(ref);
- d_func()->m_scaleFactor = refState->d_func()->m_scaleFactor;
- d_func()->m_depthSteps = refState->d_func()->m_depthSteps;
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QPolygonOffset::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QPolygonOffsetData>::create(this);
diff --git a/src/render/renderstates/qpolygonoffset.h b/src/render/renderstates/qpolygonoffset.h
index 599397e42..6192f70fd 100644
--- a/src/render/renderstates/qpolygonoffset.h
+++ b/src/render/renderstates/qpolygonoffset.h
@@ -68,12 +68,8 @@ Q_SIGNALS:
void scaleFactorChanged(float scaleFactor);
void depthStepsChanged(float depthSteps);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QPolygonOffset)
- QT3D_CLONEABLE(QPolygonOffset)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qrenderstate.cpp b/src/render/renderstates/qrenderstate.cpp
index 9167366ff..19a25fc72 100644
--- a/src/render/renderstates/qrenderstate.cpp
+++ b/src/render/renderstates/qrenderstate.cpp
@@ -61,11 +61,6 @@ const QRenderStatePrivate *QRenderStatePrivate::get(const QRenderState *state)
return state->d_func();
}
-QRenderState::~QRenderState()
-{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QRenderState subclass didn't call QNode::cleanup in its destructor");
-}
-
/*! \internal */
QRenderState::QRenderState(QRenderStatePrivate &dd, QNode *parent)
: QNode(dd, parent)
diff --git a/src/render/renderstates/qrenderstate.h b/src/render/renderstates/qrenderstate.h
index c26bb6f27..126dfaf0f 100644
--- a/src/render/renderstates/qrenderstate.h
+++ b/src/render/renderstates/qrenderstate.h
@@ -54,9 +54,6 @@ class QT3DRENDERSHARED_EXPORT QRenderState : public Qt3DCore::QNode
{
Q_OBJECT
-public:
- ~QRenderState();
-
protected:
QRenderState(QRenderStatePrivate &dd, Qt3DCore::QNode *parent = Q_NULLPTR);
diff --git a/src/render/renderstates/qscissortest.cpp b/src/render/renderstates/qscissortest.cpp
index ea24838bc..e56ac83e6 100644
--- a/src/render/renderstates/qscissortest.cpp
+++ b/src/render/renderstates/qscissortest.cpp
@@ -51,16 +51,6 @@ QScissorTest::QScissorTest(QNode *parent)
{
}
-void QScissorTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QScissorTest *refState = static_cast<const QScissorTest*>(ref);
- d_func()->m_left = refState->d_func()->m_left;
- d_func()->m_bottom = refState->d_func()->m_bottom;
- d_func()->m_width = refState->d_func()->m_width;
- d_func()->m_height = refState->d_func()->m_height;
-}
-
int QScissorTest::left() const
{
Q_D(const QScissorTest);
diff --git a/src/render/renderstates/qscissortest.h b/src/render/renderstates/qscissortest.h
index 9e7b770cc..15b5630bf 100644
--- a/src/render/renderstates/qscissortest.h
+++ b/src/render/renderstates/qscissortest.h
@@ -77,12 +77,8 @@ Q_SIGNALS:
void widthChanged(int width);
void heightChanged(int height);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QScissorTest)
- QT3D_CLONEABLE(QScissorTest)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qseamlesscubemap.h b/src/render/renderstates/qseamlesscubemap.h
index f9fc11170..029c6d674 100644
--- a/src/render/renderstates/qseamlesscubemap.h
+++ b/src/render/renderstates/qseamlesscubemap.h
@@ -57,7 +57,6 @@ public:
private:
Q_DECLARE_PRIVATE(QSeamlessCubemap)
- QT3D_CLONEABLE(QSeamlessCubemap)
};
} // namespace Qt3DRender
diff --git a/src/render/renderstates/qstencilmask.cpp b/src/render/renderstates/qstencilmask.cpp
index fe62b87d0..79416eba9 100644
--- a/src/render/renderstates/qstencilmask.cpp
+++ b/src/render/renderstates/qstencilmask.cpp
@@ -84,14 +84,6 @@ uint QStencilMask::backOutputMask() const
return d->m_backOutputMask;
}
-void QStencilMask::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QStencilMask *otherRef = static_cast<const QStencilMask *>(ref);
- d_func()->m_frontOutputMask = otherRef->frontOutputMask();
- d_func()->m_backOutputMask = otherRef->backOutputMask();
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QStencilMask::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QStencilMaskData>::create(this);
diff --git a/src/render/renderstates/qstencilmask.h b/src/render/renderstates/qstencilmask.h
index ed75d3222..9308ab3b9 100644
--- a/src/render/renderstates/qstencilmask.h
+++ b/src/render/renderstates/qstencilmask.h
@@ -67,12 +67,8 @@ Q_SIGNALS:
void frontOutputMaskChanged(uint frontOutputMask);
void backOutputMaskChanged(uint backOutputMask);
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
private:
Q_DECLARE_PRIVATE(QStencilMask)
- QT3D_CLONEABLE(QStencilMask)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qstenciloperation.cpp b/src/render/renderstates/qstenciloperation.cpp
index b8ea5bf24..78281a8b3 100644
--- a/src/render/renderstates/qstenciloperation.cpp
+++ b/src/render/renderstates/qstenciloperation.cpp
@@ -63,18 +63,6 @@ QStencilOperationArguments *QStencilOperation::back() const
return d->m_back;
}
-void QStencilOperation::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QStencilOperation *refState = static_cast<const QStencilOperation*>(ref);
- d_func()->m_back->setDepthTestFailureOperation(refState->d_func()->m_back->depthTestFailureOperation());
- d_func()->m_back->setStencilTestFailureOperation(refState->d_func()->m_back->stencilTestFailureOperation());
- d_func()->m_back->setAllTestsPassOperation(refState->d_func()->m_back->allTestsPassOperation());
- d_func()->m_front->setDepthTestFailureOperation(refState->d_func()->m_front->depthTestFailureOperation());
- d_func()->m_front->setStencilTestFailureOperation(refState->d_func()->m_front->stencilTestFailureOperation());
- d_func()->m_front->setAllTestsPassOperation(refState->d_func()->m_front->allTestsPassOperation());
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QStencilOperation::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QStencilOperationData>::create(this);
diff --git a/src/render/renderstates/qstenciloperation.h b/src/render/renderstates/qstenciloperation.h
index 2d8a784ca..9d360a0e2 100644
--- a/src/render/renderstates/qstenciloperation.h
+++ b/src/render/renderstates/qstenciloperation.h
@@ -61,12 +61,8 @@ public:
QStencilOperationArguments *front() const;
QStencilOperationArguments *back() const;
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL;
-
private:
Q_DECLARE_PRIVATE(QStencilOperation)
- QT3D_CLONEABLE(QStencilOperation)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/renderstates/qstenciltest.cpp b/src/render/renderstates/qstenciltest.cpp
index a6ccf860d..21cf66d8a 100644
--- a/src/render/renderstates/qstenciltest.cpp
+++ b/src/render/renderstates/qstenciltest.cpp
@@ -64,18 +64,6 @@ QStencilTestArguments *QStencilTest::back() const
return d->m_back;
}
-void QStencilTest::copy(const QNode *ref)
-{
- QRenderState::copy(ref);
- const QStencilTest *refState = static_cast<const QStencilTest*>(ref);
- d_func()->m_front->setComparisonMask(refState->d_func()->m_front->comparisonMask());
- d_func()->m_front->setReferenceValue(refState->d_func()->m_front->referenceValue());
- d_func()->m_front->setStencilFunction(refState->d_func()->m_front->stencilFunction());
- d_func()->m_back->setComparisonMask(refState->d_func()->m_back->comparisonMask());
- d_func()->m_back->setReferenceValue(refState->d_func()->m_back->referenceValue());
- d_func()->m_back->setStencilFunction(refState->d_func()->m_back->stencilFunction());
-}
-
Qt3DCore::QNodeCreatedChangeBasePtr QStencilTest::createNodeCreationChange() const
{
auto creationChange = QRenderStateCreatedChangePtr<QStencilTestData>::create(this);
diff --git a/src/render/renderstates/qstenciltest.h b/src/render/renderstates/qstenciltest.h
index 3ffca7d89..295e913ca 100644
--- a/src/render/renderstates/qstenciltest.h
+++ b/src/render/renderstates/qstenciltest.h
@@ -61,12 +61,8 @@ public:
QStencilTestArguments *front() const;
QStencilTestArguments *back() const;
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
-
private:
Q_DECLARE_PRIVATE(QStencilTest)
- QT3D_CLONEABLE(QStencilTest)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/texture/qabstracttexture.cpp b/src/render/texture/qabstracttexture.cpp
index 868e3fcf0..112579b20 100644
--- a/src/render/texture/qabstracttexture.cpp
+++ b/src/render/texture/qabstracttexture.cpp
@@ -68,27 +68,6 @@ QAbstractTexturePrivate::QAbstractTexturePrivate()
{
}
-void QAbstractTexture::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAbstractTexture *t = static_cast<const QAbstractTexture*>(ref);
- d_func()->m_target = t->d_func()->m_target;
- d_func()->m_width = t->d_func()->m_width;
- d_func()->m_height = t->d_func()->m_height;
- d_func()->m_depth = t->d_func()->m_depth;
- d_func()->m_format = t->d_func()->m_format;
- d_func()->m_wrapMode.setX(t->d_func()->m_wrapMode.x());
- d_func()->m_wrapMode.setY(t->d_func()->m_wrapMode.y());
- d_func()->m_wrapMode.setZ(t->d_func()->m_wrapMode.z());
- d_func()->m_minFilter = t->d_func()->m_minFilter;
- d_func()->m_magFilter = t->d_func()->m_magFilter;
- d_func()->m_autoMipMap = t->d_func()->m_autoMipMap;
- d_func()->m_maximumAnisotropy = t->d_func()->m_maximumAnisotropy;
- d_func()->m_comparisonFunction = t->d_func()->m_comparisonFunction;
- d_func()->m_comparisonMode = t->d_func()->m_comparisonMode;
- d_func()->m_layers = t->d_func()->m_layers;
-}
-
/*!
\class Qt3DRender::QAbstractTexture
\inmodule Qt3DRender
diff --git a/src/render/texture/qabstracttexture.h b/src/render/texture/qabstracttexture.h
index f25b08afe..5a76a2267 100644
--- a/src/render/texture/qabstracttexture.h
+++ b/src/render/texture/qabstracttexture.h
@@ -326,12 +326,10 @@ protected:
explicit QAbstractTexture(Target target, Qt3DCore::QNode *parent = nullptr);
QAbstractTexture(QAbstractTexturePrivate &dd, Qt3DCore::QNode *parent = nullptr);
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void setStatus(Status status);
private:
Q_DECLARE_PRIVATE(QAbstractTexture)
- QT3D_CLONEABLE(QAbstractTexture)
Qt3DCore::QNodeCreatedChangeBasePtr createNodeCreationChange() const Q_DECL_OVERRIDE;
};
diff --git a/src/render/texture/qabstracttextureimage.cpp b/src/render/texture/qabstracttextureimage.cpp
index c6266e4cc..7debb2567 100644
--- a/src/render/texture/qabstracttextureimage.cpp
+++ b/src/render/texture/qabstracttextureimage.cpp
@@ -90,7 +90,6 @@ QAbstractTextureImage::QAbstractTextureImage(QNode *parent)
*/
QAbstractTextureImage::~QAbstractTextureImage()
{
- Q_ASSERT_X(Qt3DCore::QNodePrivate::get(this)->m_wasCleanedUp, Q_FUNC_INFO, "QNode::cleanup should have been called by now. A Qt3DRender::QAbstractTextureImage subclass didn't call QNode::cleanup in its destructor");
}
@@ -201,18 +200,6 @@ void QAbstractTextureImage::notifyDataGeneratorChanged()
}
}
-/*!
- Copies \a ref into this object.
- */
-void QAbstractTextureImage::copy(const QNode *ref)
-{
- QNode::copy(ref);
- const QAbstractTextureImage *imageRef = static_cast<const QAbstractTextureImage *>(ref);
- d_func()->m_face = imageRef->face();
- d_func()->m_layer = imageRef->layer();
- d_func()->m_mipLevel = imageRef->mipLevel();
-}
-
/*! \internal */
QAbstractTextureImage::QAbstractTextureImage(QAbstractTextureImagePrivate &dd, QNode *parent)
: QNode(dd, parent)
diff --git a/src/render/texture/qabstracttextureimage.h b/src/render/texture/qabstracttextureimage.h
index dd27c1513..90e9e7194 100644
--- a/src/render/texture/qabstracttextureimage.h
+++ b/src/render/texture/qabstracttextureimage.h
@@ -92,7 +92,6 @@ Q_SIGNALS:
void faceChanged(QAbstractTexture::CubeMapFace face);
protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void notifyDataGeneratorChanged();
virtual QTextureImageDataGeneratorPtr dataGenerator() const = 0;
QAbstractTextureImage(QAbstractTextureImagePrivate &dd, Qt3DCore::QNode *parent = nullptr);
diff --git a/src/render/texture/qtextureimage.cpp b/src/render/texture/qtextureimage.cpp
index a074a514e..578867374 100644
--- a/src/render/texture/qtextureimage.cpp
+++ b/src/render/texture/qtextureimage.cpp
@@ -144,16 +144,6 @@ void QTextureImage::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change)
setStatus(static_cast<QTextureImage::Status>(e->value().toInt()));
}
-/*!
- Copies \a ref into this texture image.
- */
-void QTextureImage::copy(const QNode *ref)
-{
- QAbstractTextureImage::copy(ref);
- const QTextureImage *img = static_cast<const QTextureImage *>(ref);
- d_func()->m_source = img->source();
-}
-
} // namespace Qt3DRender
QT_END_NAMESPACE
diff --git a/src/render/texture/qtextureimage.h b/src/render/texture/qtextureimage.h
index db6e0276d..878c27406 100644
--- a/src/render/texture/qtextureimage.h
+++ b/src/render/texture/qtextureimage.h
@@ -78,13 +78,11 @@ Q_SIGNALS:
protected:
void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) Q_DECL_OVERRIDE;
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE;
void setStatus(Status status);
private:
QTextureImageDataGeneratorPtr dataGenerator() const Q_DECL_OVERRIDE;
Q_DECLARE_PRIVATE(QTextureImage)
- QT3D_CLONEABLE(QTextureImage)
};
} // namespace Qt3DRender
diff --git a/tests/auto/core/cloning/cloning.pro b/tests/auto/core/cloning/cloning.pro
deleted file mode 100644
index d6ecaf489..000000000
--- a/tests/auto/core/cloning/cloning.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TARGET = tst_cloning
-CONFIG += testcase
-TEMPLATE = app
-
-SOURCES += \
- tst_cloning.cpp
-
-QT += testlib core-private 3dcore 3dcore-private
diff --git a/tests/auto/core/cloning/tst_cloning.cpp b/tests/auto/core/cloning/tst_cloning.cpp
deleted file mode 100644
index 3ab68e34a..000000000
--- a/tests/auto/core/cloning/tst_cloning.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt3D module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <Qt3DCore/qentity.h>
-#include <Qt3DCore/qcomponent.h>
-#include <Qt3DCore/private/qnode_p.h>
-#include <Qt3DCore/private/qscene_p.h>
-
-class tst_Cloning : public QObject
-{
- Q_OBJECT
-public:
- tst_Cloning() : QObject() {}
- ~tst_Cloning() {}
-
-private slots:
- void checkEntityCloning();
-};
-
-class MyQNode : public Qt3DCore::QNode
-{
- Q_OBJECT
-public:
- explicit MyQNode(Qt3DCore::QNode *parent = 0) : QNode(parent)
- {}
-
- void setCustomProperty(const QString &s) { m_customProperty = s; }
- QString customProperty() const { return m_customProperty; }
-
- QT3D_CLONEABLE(MyQNode)
-
- QString m_customProperty;
-
- static QNode *clone(QNode *node) {
- return QNode::clone(node);
- }
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_OVERRIDE
- {
- Qt3DCore::QNode::copy(ref);
- const MyQNode *refNode = qobject_cast<const MyQNode *>(ref);
- setCustomProperty(refNode->customProperty());
- }
-};
-
-class MyQComponent : public Qt3DCore::QComponent
-{
- Q_OBJECT
-public:
- explicit MyQComponent(Qt3DCore::QNode *parent = 0) : QComponent(parent)
- {}
-
- QT3D_CLONEABLE(MyQComponent)
-};
-
-void tst_Cloning::checkEntityCloning()
-{
- // GIVEN
- Qt3DCore::QScene *scene = new Qt3DCore::QScene();
- MyQNode *root = new MyQNode();
- Qt3DCore::QNodePrivate::get(root)->setScene(scene);
-
- Qt3DCore::QEntity *entity = new Qt3DCore::QEntity(root);
-
- // WHEN
- MyQComponent *comp1 = new MyQComponent();
- MyQComponent *comp2 = new MyQComponent();
- MyQComponent *comp3 = new MyQComponent();
-
- MyQNode *childNode = new MyQNode(entity);
- entity->addComponent(comp1);
- entity->addComponent(comp2);
- entity->addComponent(comp3);
-
- root->setCustomProperty(QStringLiteral("Corvette"));
-
- // THEN
- QVERIFY(root->customProperty() == QStringLiteral("Corvette"));
- QCOMPARE(root->children().count(), 1);
- QCOMPARE(entity->children().count(), 4);
- QCOMPARE(entity->components().count(), 3);
-
- //WHEN
- MyQNode *cloneRoot = qobject_cast<MyQNode *>(MyQNode::clone(root));
-
- // THEN
- QCOMPARE(cloneRoot->children().count(), 1);
- QCOMPARE(cloneRoot->id(), root->id());
- QVERIFY(cloneRoot->customProperty() == root->customProperty());
-
- Qt3DCore::QEntity *cloneEntity = qobject_cast<Qt3DCore::QEntity *>(cloneRoot->children().first());
- QVERIFY(cloneEntity != Q_NULLPTR);
- QCOMPARE(cloneEntity->id(), entity->id());
- QCOMPARE(cloneEntity->children().count(), 4);
- QCOMPARE(cloneEntity->components().count(), 3);
-
- QVector<Qt3DCore::QNodeId> ids = QVector<Qt3DCore::QNodeId>() << comp1->id() << comp2->id() << comp3->id() << childNode->id();
-
- Q_FOREACH (QObject *c, cloneEntity->children()) {
- Qt3DCore::QNode *n = qobject_cast<Qt3DCore::QNode *>(c);
- QVERIFY(ids.contains(n->id()));
- ids.removeAll(n->id());
- }
-
- delete cloneRoot;
-}
-
-QTEST_APPLESS_MAIN(tst_Cloning)
-
-#include "tst_cloning.moc"
-
diff --git a/tests/auto/core/core.pro b/tests/auto/core/core.pro
index 9d5b1a1b4..317bef16e 100644
--- a/tests/auto/core/core.pro
+++ b/tests/auto/core/core.pro
@@ -7,18 +7,17 @@ SUBDIRS = \
qcircularbuffer \
qboundedcircularbuffer \
nodes \
- qentity \
qaspectengine \
qaspectfactory \
qaspectjob \
qchangearbiter \
qscene \
- qservicelocator \
- qtransform
+ qservicelocator
contains(QT_CONFIG, private_tests) {
SUBDIRS += \
+ qentity \
qframeallocator \
- cloning \
+ qtransform \
threadpooler
}
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp
index 418625c31..b64e63bd3 100644
--- a/tests/auto/core/nodes/tst_nodes.cpp
+++ b/tests/auto/core/nodes/tst_nodes.cpp
@@ -78,7 +78,6 @@ private slots:
void changeCustomProperty();
void checkDestruction();
- void verifyCopy();
};
class ObserverSpy;
@@ -194,17 +193,10 @@ public:
Qt3DCore::QNodePrivate::get(this)->setScene(m_scene);
}
- void makeCopyOf(QNode *other)
- {
- QNode::copy(other);
- }
-
signals:
void customPropertyChanged();
protected:
- QT3D_CLONEABLE_CUSTOM_DTOR(MyQNode)
-
QString m_customProperty;
Qt3DCore::QScene *m_scene;
};
@@ -215,10 +207,6 @@ class MyQComponent : public Qt3DCore::QComponent
public:
explicit MyQComponent(Qt3DCore::QNode *parent = 0) : QComponent(parent)
{}
-
- // QNode interface
-protected:
- QT3D_CLONEABLE(MyQComponent)
};
@@ -369,12 +357,11 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneExplicitParenting()
QVERIFY(spy.events.first().wasLocked());
QCOMPARE(node->children().count(), 1);
- Qt3DCore::QNodePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QCOMPARE(clone->parentNode()->id(), node->id());
+ Qt3DCore::QNodeCreatedChangeBasePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ QCOMPARE(event->subjectId(), child->id());
+ QCOMPARE(event->metaObject(), child->metaObject());
+ QCOMPARE(event->isNodeEnabled(), child->isEnabled());
+ QCOMPARE(event->parentId(), child->parentNode()->id());
}
void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting()
@@ -401,12 +388,11 @@ void tst_Nodes::appendSingleChildNodeToNodeSceneImplicitParenting()
QVERIFY(spy.events.first().wasLocked());
QCOMPARE(node->children().count(), 1);
- Qt3DCore::QNodePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QCOMPARE(clone->parentNode()->id(), node->id());
+ Qt3DCore::QNodeCreatedChangeBasePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ QCOMPARE(event->subjectId(), child->id());
+ QCOMPARE(event->metaObject(), child->metaObject());
+ QCOMPARE(event->isNodeEnabled(), child->isEnabled());
+ QCOMPARE(event->parentId(), child->parentNode()->id());
}
void tst_Nodes::appendMultipleChildNodesToNodeScene()
@@ -442,23 +428,16 @@ void tst_Nodes::appendMultipleChildNodesToNodeScene()
// THEN
QCOMPARE(spy.events.size(), 10);
+ int i = 0;
Q_FOREACH (const ObserverSpy::ChangeRecord &r, spy.events) {
QVERIFY(r.wasLocked());
- Qt3DCore::QNodePropertyChangePtr event = r.change().dynamicCast<Qt3DCore::QNodePropertyChange>();
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ Qt3DCore::QNode *child = node->childNodes().at(i++);
QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
-
- bool found = false;
- Q_FOREACH (QObject *c, node->children()) {
- if (clone->id() == qobject_cast<Qt3DCore::QNode *>(c)->id()) {
- found = true;
- QCOMPARE(clone->parentNode()->id(), node->id());
- break;
- }
- }
- QVERIFY(found);
+ QCOMPARE(event->subjectId(), child->id());
+ QCOMPARE(event->metaObject(), child->metaObject());
+ QCOMPARE(event->isNodeEnabled(), child->isEnabled());
}
}
@@ -488,12 +467,9 @@ void tst_Nodes::checkParentChangeToNull()
QCOMPARE(spy.events.size(), 1);
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QNodePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(!clone->parentNode());
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QCOMPARE(event->type(), Qt3DCore::NodeDeleted);
+ QCOMPARE(event->subjectId(), child->id());
}
void tst_Nodes::checkParentChangeToOtherParent()
@@ -535,21 +511,17 @@ void tst_Nodes::checkParentChangeToOtherParent()
// CHECK event 1 is a Node Deleted event
QVERIFY(spyParent1.events.first().wasLocked());
- Qt3DCore::QNodePropertyChangePtr event = spyParent1.events.takeFirst().change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(!clone->parentNode());
+ const auto event = spyParent1.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QCOMPARE(event->type(), Qt3DCore::NodeDeleted);
+ QCOMPARE(event->subjectId(), child->id());
// CHECK event 2 is a Node Added event
QVERIFY(spyParent2.events.last().wasLocked());
- event = spyParent2.events.last().change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeCreated);
- QCOMPARE(event->propertyName(), "node");
- clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(clone->parentNode());
+ const auto event2 = spyParent2.events.last().change().dynamicCast<Qt3DCore::QNodeCreatedChangeBase>();
+ QCOMPARE(event2->type(), Qt3DCore::NodeCreated);
+ QCOMPARE(event2->subjectId(), child->id());
+ QCOMPARE(event2->metaObject(), child->metaObject());
+ QCOMPARE(event2->isNodeEnabled(), child->isEnabled());
}
@@ -560,6 +532,7 @@ void tst_Nodes::removingSingleChildNodeFromNode()
QScopedPointer<Qt3DCore::QNode> child(new MyQNode());
// WHEN
+ root->assignScene();
child->setParent(root.data());
// THEN
@@ -576,12 +549,9 @@ void tst_Nodes::removingSingleChildNodeFromNode()
QCOMPARE(spy.events.size(), 1);
QVERIFY(spy.events.first().wasLocked());
- Qt3DCore::QNodePropertyChangePtr event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QCOMPARE(clone->id(), child->id());
- QVERIFY(!clone->parentNode());
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QCOMPARE(event->type(), Qt3DCore::NodeDeleted);
+ QCOMPARE(event->subjectId(), child->id());
}
void tst_Nodes::removingMultipleChildNodesFromNode()
@@ -597,8 +567,11 @@ void tst_Nodes::removingMultipleChildNodesFromNode()
QVERIFY(Qt3DCore::QNodePrivate::get(root.data())->scene() != Q_NULLPTR);
// WHEN
- for (int i = 0; i < 10; i++)
- (void) new MyQNode(root.data());
+ Qt3DCore::QNodeIdVector childIds(10);
+ for (int i = 0; i < 10; i++) {
+ auto child = new MyQNode(root.data());
+ childIds[i] = child->id();
+ }
QCoreApplication::processEvents();
@@ -614,13 +587,12 @@ void tst_Nodes::removingMultipleChildNodesFromNode()
// THEN
QVERIFY(root->children().count() == 0);
QCOMPARE(spy.events.size(), 10);
+ int i = 0;
Q_FOREACH (const ObserverSpy::ChangeRecord &r, spy.events) {
QVERIFY(r.wasLocked());
- Qt3DCore::QNodePropertyChangePtr event = r.change().dynamicCast<Qt3DCore::QNodePropertyChange>();
- QCOMPARE(event->type(), Qt3DCore::NodeAboutToBeDeleted);
- QCOMPARE(event->propertyName(), "node");
- Qt3DCore::QNodePtr clone = event->value().value<Qt3DCore::QNodePtr>();
- QVERIFY(!clone->parentNode());
+ const auto event = spy.events.takeFirst().change().dynamicCast<Qt3DCore::QNodeDestroyedChange>();
+ QCOMPARE(event->type(), Qt3DCore::NodeDeleted);
+ QCOMPARE(event->subjectId(), childIds.at(i++));
}
}
@@ -801,32 +773,6 @@ void tst_Nodes::checkDestruction()
QVERIFY(root->children().isEmpty());
}
-void tst_Nodes::verifyCopy()
-{
- // GIVEN
- QScopedPointer<MyQNode> root(new MyQNode());
- MyQNode *other1 = new MyQNode();
- MyQNode *other2 = new MyQNode();
-
- // THEN
- QVERIFY(root->id() != other1->id());
- QVERIFY(root->id() != other2->id());
- QVERIFY(other1->id() != other2->id());
-
- // WHEN
- other1->makeCopyOf(root.data());
-
- // THEN
- QVERIFY(root->id() == other1->id());
- QVERIFY(root->id() != other2->id());
-
- // WHEN
- other2->makeCopyOf(other1);
-
- // THEN
- QVERIFY(root->id() == other1->id() && root->id() == other2->id());
-}
-
QTEST_MAIN(tst_Nodes)
#include "tst_nodes.moc"
diff --git a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
index 62e624106..e7214f4ad 100644
--- a/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
+++ b/tests/auto/core/qchangearbiter/tst_qchangearbiter.cpp
@@ -122,15 +122,6 @@ public:
return m_lastChanges;
}
- // QNode interface
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- tst_Node *clone = new tst_Node();
- clone->copy(this);
- return clone;
- }
-
private:
QList<Qt3DCore::QSceneChangePtr> m_lastChanges;
};
diff --git a/tests/auto/core/qentity/tst_qentity.cpp b/tests/auto/core/qentity/tst_qentity.cpp
index 208191d33..616ce3a33 100644
--- a/tests/auto/core/qentity/tst_qentity.cpp
+++ b/tests/auto/core/qentity/tst_qentity.cpp
@@ -29,6 +29,7 @@
#include <QtTest/QtTest>
#include <Qt3DCore/qentity.h>
#include <Qt3DCore/private/qentity_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DCore/qcomponent.h>
#include <QtCore/qscopedpointer.h>
@@ -56,7 +57,9 @@ private slots:
void addSeveralTimesSameComponent();
void removeSeveralTimesSameComponent();
- void verifyCopy();
+
+ void checkCloning_data();
+ void checkCloning();
};
class MyQComponent : public Qt3DCore::QComponent
@@ -66,9 +69,6 @@ public:
explicit MyQComponent(Qt3DCore::QNode *parent = 0)
: QComponent(parent)
{}
-
-protected:
- QT3D_CLONEABLE(MyQComponent)
};
@@ -78,11 +78,6 @@ public:
explicit MyEntity(Qt3DCore::QNode *parent = 0)
: QEntity(parent)
{}
-
- void makeCopyOf(Qt3DCore::QEntity *other)
- {
- QEntity::copy(other);
- }
};
void tst_Entity::constructionDestruction()
@@ -553,45 +548,58 @@ void tst_Entity::removeSeveralTimesSameComponent()
QCOMPARE(comp->entities().size(), 0);
}
-Qt3DCore::QNodeId parentEntityId(Qt3DCore::QEntity *entity)
+void tst_Entity::checkCloning_data()
{
- Qt3DCore::QEntityPrivate *d = static_cast<Qt3DCore::QEntityPrivate*>(Qt3DCore::QNodePrivate::get(entity));
- return d->parentEntityId();
+ QTest::addColumn<Qt3DCore::QEntity *>("entity");
+
+ QTest::newRow("defaultConstructed") << new MyEntity();
+
+ Qt3DCore::QEntity *entityWithComponents = new MyEntity();
+ Qt3DCore::QComponent *component1 = new MyQComponent();
+ Qt3DCore::QComponent *component2 = new MyQComponent();
+ Qt3DCore::QComponent *component3 = new MyQComponent();
+ entityWithComponents->addComponent(component1);
+ entityWithComponents->addComponent(component2);
+ entityWithComponents->addComponent(component3);
+ QTest::newRow("entityWithComponents") << entityWithComponents;
}
-void tst_Entity::verifyCopy()
+void tst_Entity::checkCloning()
{
// GIVEN
- QScopedPointer<Qt3DCore::QEntity> root(new Qt3DCore::QEntity());
- MyEntity *parentLessEntity = new MyEntity();
- MyEntity *parentedEntity = new MyEntity(root.data());
-
- QCoreApplication::processEvents();
-
- // THEN
- QVERIFY(root->id() != parentLessEntity->id());
- QVERIFY(root->id() != parentedEntity->id());
- QVERIFY(parentEntityId(root.data()).isNull());
- QVERIFY(!parentEntityId(parentedEntity).isNull());
- QVERIFY(parentEntityId(parentLessEntity).isNull());
+ QFETCH(Qt3DCore::QEntity *, entity);
// WHEN
- MyEntity *parentedEntityCopy = new MyEntity();
- parentedEntityCopy->makeCopyOf(parentedEntity);
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(entity);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(parentedEntityCopy->id() == parentedEntity->id());
- QVERIFY(parentEntityId(parentedEntityCopy) == parentEntityId(parentedEntity));
+ QCOMPARE(creationChanges.size(), 1 + entity->components().size());
- // WHEN
- MyEntity *parentLessEntityCopy = new MyEntity();
- parentLessEntityCopy->makeCopyOf(parentLessEntity);
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DCore::QEntityData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DCore::QEntityData>>(creationChanges.first());
+ const Qt3DCore::QEntityData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(parentLessEntityCopy->id() == parentLessEntity->id());
- QVERIFY(parentEntityId(parentLessEntityCopy) == parentEntityId(parentLessEntity));
+ QCOMPARE(creationChangeData->subjectId(), entity->id());
+ QCOMPARE(creationChangeData->isNodeEnabled(), entity->isEnabled());
+ QCOMPARE(creationChangeData->metaObject(), entity->metaObject());
+ QCOMPARE(creationChangeData->parentId(), entity->parentNode() ? entity->parentNode()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(cloneData.parentEntityId, entity->parentEntity() ? entity->parentEntity()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(cloneData.componentIdsAndTypes.size(), entity->components().size());
+
+ const QVector<Qt3DCore::QComponent *> &components = entity->components();
+ for (int i = 0, m = components.size(); i < m; ++i) {
+ QCOMPARE(cloneData.componentIdsAndTypes.at(i).id, components.at(i)->id());
+ QCOMPARE(cloneData.componentIdsAndTypes.at(i).type, components.at(i)->metaObject());
+ }
}
+Qt3DCore::QNodeId parentEntityId(Qt3DCore::QEntity *entity)
+{
+ Qt3DCore::QEntityPrivate *d = static_cast<Qt3DCore::QEntityPrivate*>(Qt3DCore::QNodePrivate::get(entity));
+ return d->parentEntityId();
+}
QTEST_MAIN(tst_Entity)
diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp
index 67e8855d8..1c4003467 100644
--- a/tests/auto/core/qscene/tst_qscene.cpp
+++ b/tests/auto/core/qscene/tst_qscene.cpp
@@ -83,9 +83,6 @@ class tst_Node : public Qt3DCore::QNode
public:
tst_Node() : Qt3DCore::QNode()
{}
-
-protected:
- QT3D_CLONEABLE(tst_Node)
};
class tst_Component : public Qt3DCore::QComponent
@@ -94,9 +91,6 @@ class tst_Component : public Qt3DCore::QComponent
public:
tst_Component() : Qt3DCore::QComponent()
{}
-
-protected:
- QT3D_CLONEABLE(tst_Component)
};
void tst_QScene::addObservable()
diff --git a/tests/auto/core/qtransform/tst_qtransform.cpp b/tests/auto/core/qtransform/tst_qtransform.cpp
index 43ee5cfed..7668e6c67 100644
--- a/tests/auto/core/qtransform/tst_qtransform.cpp
+++ b/tests/auto/core/qtransform/tst_qtransform.cpp
@@ -29,12 +29,14 @@
#include <QtTest/QtTest>
#include <Qt3DCore/qtransform.h>
#include <Qt3DCore/qcomponent.h>
+#include <Qt3DCore/private/qtransform_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <QtCore/qscopedpointer.h>
#include "testpostmanarbiter.h"
using namespace Qt3DCore;
-class tst_QTransform : public QNode
+class tst_QTransform : public QObject
{
Q_OBJECT
@@ -75,17 +77,24 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QTransform *, transform);
// WHEN
- Qt3DCore::QTransform *clone = static_cast<Qt3DCore::QTransform *>(QNode::clone(transform));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(transform);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(transform->id(), clone->id());
- QCOMPARE(transform->matrix(), clone->matrix());
- QCOMPARE(transform->translation(), clone->translation());
- QCOMPARE(transform->scale3D(), clone->scale3D());
- QCOMPARE(transform->scale(), clone->scale());
- QCOMPARE(transform->rotation(), clone->rotation());
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DCore::QTransformData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DCore::QTransformData>>(creationChanges.first());
+ const Qt3DCore::QTransformData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(creationChangeData->subjectId(), transform->id());
+ QCOMPARE(creationChangeData->isNodeEnabled(), transform->isEnabled());
+ QCOMPARE(creationChangeData->metaObject(), transform->metaObject());
+ QCOMPARE(creationChangeData->parentId(), transform->parentNode() ? transform->parentNode()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(transform->translation(), cloneData.translation);
+ QCOMPARE(transform->scale3D(), cloneData.scale);
+ QCOMPARE(transform->rotation(), cloneData.rotation);
}
void checkPropertyUpdates()
@@ -187,12 +196,6 @@ private Q_SLOTS:
// Note: t.matrix() != t2.matrix() since different matrices
// can result in the same scale, rotation, translation
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
};
QTEST_MAIN(tst_QTransform)
diff --git a/tests/auto/input/commons/testdevice.h b/tests/auto/input/commons/testdevice.h
index fac185710..af956a3b9 100644
--- a/tests/auto/input/commons/testdevice.h
+++ b/tests/auto/input/commons/testdevice.h
@@ -43,13 +43,4 @@ public:
QStringList buttonNames() const Q_DECL_FINAL { return QStringList(); }
int axisIdentifier(const QString &name) const Q_DECL_FINAL { Q_UNUSED(name) return 0; }
int buttonIdentifier(const QString &name) const Q_DECL_FINAL { Q_UNUSED(name) return 0; }
-
-protected:
- void copy(const Qt3DCore::QNode *ref) Q_DECL_FINAL
- {
- QAbstractPhysicalDevice::copy(ref);
- }
-
-private:
- QT3D_CLONEABLE(TestDevice)
};
diff --git a/tests/auto/input/qaction/tst_qaction.cpp b/tests/auto/input/qaction/tst_qaction.cpp
index 2ad62e2e3..063d0e499 100644
--- a/tests/auto/input/qaction/tst_qaction.cpp
+++ b/tests/auto/input/qaction/tst_qaction.cpp
@@ -29,9 +29,12 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QAction>
#include <Qt3DInput/QActionInput>
+#include <Qt3DInput/private/qaction_p.h>
+#include <Qt3DInput/private/qactioninput_p.h>
#include <Qt3DCore/QNodePropertyChange>
#include <Qt3DCore/QNodeAddedPropertyChange>
@@ -78,19 +81,26 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QAction *, action);
// WHEN
- Qt3DInput::QAction *clone = static_cast<Qt3DInput::QAction *>(QNode::clone(action));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(action);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(action->id(), clone->id());
- QCOMPARE(action->inputs().count(), clone->inputs().count());
- QCOMPARE(action->isActive(), clone->isActive());
+ QCOMPARE(creationChanges.size(), 1 + action->inputs().size());
- for (int i = 0, m = action->inputs().count(); i < m; ++i) {
- QCOMPARE(action->inputs().at(i)->id(), clone->inputs().at(i)->id());
- }
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QActionData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QActionData>>(creationChanges.first());
+ const Qt3DInput::QActionData &cloneActionData = creationChangeData->data;
+ // THEN
+ QCOMPARE(creationChangeData->subjectId(), action->id());
+ QCOMPARE(creationChangeData->isNodeEnabled(), action->isEnabled());
+ QCOMPARE(creationChangeData->metaObject(), action->metaObject());
+ QCOMPARE(creationChangeData->parentId(), action->parentNode() ? action->parentNode()->id() : Qt3DCore::QNodeId());
+ QCOMPARE(cloneActionData.inputIds.size(), action->inputs().size());
+
+ const QVector<Qt3DInput::QAbstractActionInput *> &inputs = action->inputs();
+ for (int i = 0, m = inputs.size(); i < m; ++i)
+ QCOMPARE(cloneActionData.inputIds.at(i), inputs.at(i)->id());
}
void checkPropertyUpdates()
@@ -142,14 +152,6 @@ private Q_SLOTS:
// THEN
QCOMPARE(isActive(), true);
}
-
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QAction)
diff --git a/tests/auto/input/qactioninput/tst_qactioninput.cpp b/tests/auto/input/qactioninput/tst_qactioninput.cpp
index 22f06bc4f..fb357a711 100644
--- a/tests/auto/input/qactioninput/tst_qactioninput.cpp
+++ b/tests/auto/input/qactioninput/tst_qactioninput.cpp
@@ -27,18 +27,19 @@
****************************************************************************/
#include <QtTest/QTest>
+#include <Qt3DCore/qnodeid.h>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
+#include <Qt3DInput/private/qactioninput_p.h>
#include <Qt3DInput/QActionInput>
#include <Qt3DInput/QAbstractPhysicalDevice>
#include "testpostmanarbiter.h"
#include "testdevice.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QActionInput: public Qt3DCore::QNode
+class tst_QActionInput: public QObject
{
Q_OBJECT
public:
@@ -72,18 +73,22 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QActionInput *, actionInput);
// WHEN
- Qt3DInput::QActionInput *clone = static_cast<Qt3DInput::QActionInput *>(QNode::clone(actionInput));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(actionInput);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + (actionInput->sourceDevice() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QActionInputData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QActionInputData>>(creationChanges.first());
+ const Qt3DInput::QActionInputData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(actionInput->id(), clone->id());
- QCOMPARE(actionInput->buttons(), clone->buttons());
-
- if (actionInput->sourceDevice() != Q_NULLPTR) {
- QVERIFY(clone->sourceDevice() != Q_NULLPTR);
- QCOMPARE(clone->sourceDevice()->id(), actionInput->sourceDevice()->id());
- }
+ QCOMPARE(actionInput->id(), creationChangeData->subjectId());
+ QCOMPARE(actionInput->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(actionInput->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(actionInput->buttons(), cloneData.buttons);
+ QCOMPARE(actionInput->sourceDevice() ? actionInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId);
}
void checkPropertyUpdates()
@@ -120,13 +125,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QActionInput)
diff --git a/tests/auto/input/qaxis/tst_qaxis.cpp b/tests/auto/input/qaxis/tst_qaxis.cpp
index 74a36584d..a0add024c 100644
--- a/tests/auto/input/qaxis/tst_qaxis.cpp
+++ b/tests/auto/input/qaxis/tst_qaxis.cpp
@@ -29,9 +29,11 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QAxis>
#include <Qt3DInput/QAxisInput>
+#include <Qt3DInput/private/qaxis_p.h>
#include <Qt3DCore/QNodePropertyChange>
#include <Qt3DCore/QNodeAddedPropertyChange>
@@ -78,19 +80,24 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QAxis *, axis);
// WHEN
- Qt3DInput::QAxis *clone = static_cast<Qt3DInput::QAxis *>(QNode::clone(axis));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axis);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(axis->id(), clone->id());
- QCOMPARE(axis->inputs().count(), clone->inputs().count());
- QCOMPARE(axis->value(), clone->value());
+ QCOMPARE(creationChanges.size(), 1 + axis->inputs().size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QAxisData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QAxisData>>(creationChanges.first());
+ const Qt3DInput::QAxisData &cloneData = creationChangeData->data;
- for (int i = 0, m = axis->inputs().count(); i < m; ++i) {
- QCOMPARE(axis->inputs().at(i)->id(), clone->inputs().at(i)->id());
- }
+ // THEN
+ QCOMPARE(axis->id(), creationChangeData->subjectId());
+ QCOMPARE(axis->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(axis->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axis->inputs().count(), cloneData.inputIds.count());
+ for (int i = 0, m = axis->inputs().count(); i < m; ++i)
+ QCOMPARE(axis->inputs().at(i)->id(), cloneData.inputIds.at(i));
}
void checkPropertyUpdates()
@@ -142,14 +149,6 @@ private Q_SLOTS:
// THEN
QCOMPARE(value(), 383.0f);
}
-
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QAxis)
diff --git a/tests/auto/input/qaxisinput/tst_qaxisinput.cpp b/tests/auto/input/qaxisinput/tst_qaxisinput.cpp
index cc196ff82..c9e5dbae8 100644
--- a/tests/auto/input/qaxisinput/tst_qaxisinput.cpp
+++ b/tests/auto/input/qaxisinput/tst_qaxisinput.cpp
@@ -29,16 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QAxisInput>
#include <Qt3DInput/QAbstractPhysicalDevice>
+#include <Qt3DInput/private/qaxisinput_p.h>
#include "testpostmanarbiter.h"
#include "testdevice.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QAxisInput: public Qt3DCore::QNode
+class tst_QAxisInput: public QObject
{
Q_OBJECT
public:
@@ -76,20 +76,24 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QAxisInput *, axisInput);
// WHEN
- Qt3DInput::QAxisInput *clone = static_cast<Qt3DInput::QAxisInput *>(QNode::clone(axisInput));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(axisInput);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + (axisInput->sourceDevice() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QAxisInputData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QAxisInputData>>(creationChanges.first());
+ const Qt3DInput::QAxisInputData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(axisInput->id(), clone->id());
- QCOMPARE(axisInput->buttons(), clone->buttons());
- QCOMPARE(axisInput->axis(), clone->axis());
- QCOMPARE(axisInput->scale(), clone->scale());
-
- if (axisInput->sourceDevice() != Q_NULLPTR) {
- QVERIFY(clone->sourceDevice() != Q_NULLPTR);
- QCOMPARE(clone->sourceDevice()->id(), axisInput->sourceDevice()->id());
- }
+ QCOMPARE(axisInput->id(), creationChangeData->subjectId());
+ QCOMPARE(axisInput->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(axisInput->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axisInput->buttons(), cloneData.buttons);
+ QCOMPARE(axisInput->axis(), cloneData.axis);
+ QCOMPARE(axisInput->scale(), cloneData.scale);
+ QCOMPARE(axisInput->sourceDevice() ? axisInput->sourceDevice()->id() : Qt3DCore::QNodeId(), cloneData.sourceDeviceId);
}
void checkPropertyUpdates()
@@ -152,13 +156,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QAxisInput)
diff --git a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp
index 3982c3a97..dc8cf15c8 100644
--- a/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp
+++ b/tests/auto/input/qlogicaldevice/tst_qlogicaldevice.cpp
@@ -29,8 +29,10 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DInput/QLogicalDevice>
+#include <Qt3DInput/private/qlogicaldevice_p.h>
#include <Qt3DInput/QAxis>
#include <Qt3DInput/QAction>
@@ -40,9 +42,7 @@
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QLogicalDevice: public Qt3DCore::QNode
+class tst_QLogicalDevice: public QObject
{
Q_OBJECT
public:
@@ -79,26 +79,31 @@ private Q_SLOTS:
QFETCH(Qt3DInput::QLogicalDevice *, logicalDevice);
// WHEN
- Qt3DInput::QLogicalDevice *clone = static_cast<Qt3DInput::QLogicalDevice *>(QNode::clone(logicalDevice));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(logicalDevice);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(logicalDevice->id(), clone->id());
const int axesCount = logicalDevice->axes().count();
const int actionsCount = logicalDevice->actions().count();
- QCOMPARE(axesCount, clone->axes().count());
- QCOMPARE(actionsCount, clone->actions().count());
-
- if (axesCount > 0) {
- for (int i = 0; i < axesCount; ++i)
- QCOMPARE(logicalDevice->axes().at(i)->id(), clone->axes().at(i)->id());
- }
-
- if (actionsCount > 0) {
- for (int i = 0; i < actionsCount; ++i)
- QCOMPARE(logicalDevice->actions().at(i)->id(), clone->actions().at(i)->id());
- }
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + axesCount + actionsCount);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DInput::QLogicalDeviceData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DInput::QLogicalDeviceData>>(creationChanges.first());
+ const Qt3DInput::QLogicalDeviceData &cloneData = creationChangeData->data;
+
+ // THEN
+ QCOMPARE(logicalDevice->id(), creationChangeData->subjectId());
+ QCOMPARE(logicalDevice->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(logicalDevice->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(axesCount, cloneData.axisIds.count());
+ QCOMPARE(actionsCount, cloneData.actionIds.count());
+
+ for (int i = 0; i < axesCount; ++i)
+ QCOMPARE(logicalDevice->axes().at(i)->id(), cloneData.axisIds.at(i));
+
+ for (int i = 0; i < actionsCount; ++i)
+ QCOMPARE(logicalDevice->actions().at(i)->id(), cloneData.actionIds.at(i));
}
void checkPropertyUpdates()
@@ -161,13 +166,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QLogicalDevice)
diff --git a/tests/auto/render/qabstractlight/tst_qabstractlight.cpp b/tests/auto/render/qabstractlight/tst_qabstractlight.cpp
index d8452a461..8496c6f43 100644
--- a/tests/auto/render/qabstractlight/tst_qabstractlight.cpp
+++ b/tests/auto/render/qabstractlight/tst_qabstractlight.cpp
@@ -29,12 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qabstractlight.h>
#include <Qt3DRender/private/qabstractlight_p.h>
#include <Qt3DRender/qpointlight.h>
#include <Qt3DRender/qdirectionallight.h>
#include <Qt3DRender/qspotlight.h>
+#include <Qt3DRender/private/qpointlight_p.h>
+#include <Qt3DRender/private/qdirectionallight_p.h>
+#include <Qt3DRender/private/qspotlight_p.h>
#include "testpostmanarbiter.h"
@@ -46,9 +50,6 @@ public:
explicit DummyLight(Qt3DCore::QNode *parent = Q_NULLPTR)
: QAbstractLight(*new Qt3DRender::QAbstractLightPrivate(QAbstractLight::PointLight), parent)
{}
-
-private:
- QT3D_CLONEABLE(DummyLight)
};
@@ -57,79 +58,88 @@ private:
class tst_QAbstractLight: public Qt3DCore::QNode
{
Q_OBJECT
-public:
- ~tst_QAbstractLight()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
-
- void checkLightCloning()
- {
- DummyLight light;
- light.setColor(Qt::red);
- light.setIntensity(0.5f);
-
- QScopedPointer<Qt3DRender::QAbstractLight> lightClone(static_cast<Qt3DRender::QAbstractLight *>(QNode::clone(&light)));
- QVERIFY(lightClone.data());
- QCOMPARE(light.color(), lightClone->color());
- QCOMPARE(light.intensity(), lightClone->intensity());
- }
-
- void checkPointLightCloning()
- {
- Qt3DRender::QPointLight pointLight;
- QCOMPARE(pointLight.type(), Qt3DRender::QAbstractLight::PointLight);
- pointLight.setColor(Qt::green);
- pointLight.setIntensity(0.5f);
- pointLight.setConstantAttenuation(0.5f);
- pointLight.setLinearAttenuation(0.0f); // No actual event triggered as 0.0f is default
- pointLight.setQuadraticAttenuation(1.0f);
-
- QScopedPointer<Qt3DRender::QPointLight> pointLightClone(static_cast<Qt3DRender::QPointLight *>(QNode::clone(&pointLight)));
- QVERIFY(pointLightClone.data());
- QCOMPARE(pointLightClone->type(), Qt3DRender::QAbstractLight::PointLight);
- QCOMPARE(pointLight.color(), pointLightClone->color());
- QCOMPARE(pointLight.intensity(), pointLightClone->intensity());
- QCOMPARE(pointLight.constantAttenuation(), pointLightClone->constantAttenuation());
- QCOMPARE(pointLight.linearAttenuation(), pointLightClone->linearAttenuation());
- QCOMPARE(pointLight.quadraticAttenuation(), pointLightClone->quadraticAttenuation());
- }
-
- void checkDirectionalLightCloning()
- {
- Qt3DRender::QDirectionalLight dirLight;
- QCOMPARE(dirLight.type(), Qt3DRender::QAbstractLight::DirectionalLight);
- dirLight.setColor(Qt::blue);
- dirLight.setIntensity(0.5f);
- dirLight.setWorldDirection(QVector3D(0, 0, -1));
-
- QScopedPointer<Qt3DRender::QDirectionalLight> dirLightClone(static_cast<Qt3DRender::QDirectionalLight *>(QNode::clone(&dirLight)));
- QVERIFY(dirLightClone.data());
- QCOMPARE(dirLightClone->type(), Qt3DRender::QAbstractLight::DirectionalLight);
- QCOMPARE(dirLight.color(), dirLightClone->color());
- QCOMPARE(dirLight.intensity(), dirLightClone->intensity());
- QCOMPARE(dirLight.worldDirection(), dirLightClone->worldDirection());
- }
-
- void checkSpotLightCloning()
- {
- Qt3DRender::QSpotLight spotLight;
- QCOMPARE(spotLight.type(), Qt3DRender::QAbstractLight::SpotLight);
- spotLight.setColor(Qt::lightGray);
- spotLight.setIntensity(0.5f);
- spotLight.setLocalDirection(QVector3D(0, 0, -1));
- spotLight.setCutOffAngle(0.75f);
-
- QScopedPointer<Qt3DRender::QSpotLight> spotLightClone(static_cast<Qt3DRender::QSpotLight *>(QNode::clone(&spotLight)));
- QVERIFY(spotLightClone.data());
- QCOMPARE(spotLightClone->type(), Qt3DRender::QAbstractLight::SpotLight);
- QCOMPARE(spotLight.color(), spotLightClone->color());
- QCOMPARE(spotLight.intensity(), spotLightClone->intensity());
- QCOMPARE(spotLight.localDirection(), spotLightClone->localDirection());
- QCOMPARE(spotLight.cutOffAngle(), spotLightClone->cutOffAngle());
- }
+ // TO DO: Test should be rewritten to query the properties from the attached QShaderData
+
+// void checkLightCloning()
+// {
+// // GIVEN
+// DummyLight light;
+// light.setColor(Qt::red);
+// light.setIntensity(0.5f);
+
+// // WHEN
+// Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(material);
+// QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+// // THEN
+// QVERIFY(creationChanges.size() >= 1);
+
+// const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QA> creationChangeData =
+// qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QMaterialData>>(creationChanges.first());
+// const Qt3DRender::QMaterialData &cloneData = creationChangeData->data;
+
+
+// QScopedPointer<Qt3DRender::QAbstractLight> lightClone(static_cast<Qt3DRender::QAbstractLight *>(QNode::clone(&light)));
+// QVERIFY(lightClone.data());
+// QCOMPARE(light.color(), lightClone->color());
+// QCOMPARE(light.intensity(), lightClone->intensity());
+// }
+
+// void checkPointLightCloning()
+// {
+// Qt3DRender::QPointLight pointLight;
+// QCOMPARE(pointLight.type(), Qt3DRender::QAbstractLight::PointLight);
+// pointLight.setColor(Qt::green);
+// pointLight.setIntensity(0.5f);
+// pointLight.setConstantAttenuation(0.5f);
+// pointLight.setLinearAttenuation(0.0f); // No actual event triggered as 0.0f is default
+// pointLight.setQuadraticAttenuation(1.0f);
+
+// QScopedPointer<Qt3DRender::QPointLight> pointLightClone(static_cast<Qt3DRender::QPointLight *>(QNode::clone(&pointLight)));
+// QVERIFY(pointLightClone.data());
+// QCOMPARE(pointLightClone->type(), Qt3DRender::QAbstractLight::PointLight);
+// QCOMPARE(pointLight.color(), pointLightClone->color());
+// QCOMPARE(pointLight.intensity(), pointLightClone->intensity());
+// QCOMPARE(pointLight.constantAttenuation(), pointLightClone->constantAttenuation());
+// QCOMPARE(pointLight.linearAttenuation(), pointLightClone->linearAttenuation());
+// QCOMPARE(pointLight.quadraticAttenuation(), pointLightClone->quadraticAttenuation());
+// }
+
+// void checkDirectionalLightCloning()
+// {
+// Qt3DRender::QDirectionalLight dirLight;
+// QCOMPARE(dirLight.type(), Qt3DRender::QAbstractLight::DirectionalLight);
+// dirLight.setColor(Qt::blue);
+// dirLight.setIntensity(0.5f);
+// dirLight.setWorldDirection(QVector3D(0, 0, -1));
+
+// QScopedPointer<Qt3DRender::QDirectionalLight> dirLightClone(static_cast<Qt3DRender::QDirectionalLight *>(QNode::clone(&dirLight)));
+// QVERIFY(dirLightClone.data());
+// QCOMPARE(dirLightClone->type(), Qt3DRender::QAbstractLight::DirectionalLight);
+// QCOMPARE(dirLight.color(), dirLightClone->color());
+// QCOMPARE(dirLight.intensity(), dirLightClone->intensity());
+// QCOMPARE(dirLight.worldDirection(), dirLightClone->worldDirection());
+// }
+
+// void checkSpotLightCloning()
+// {
+// Qt3DRender::QSpotLight spotLight;
+// QCOMPARE(spotLight.type(), Qt3DRender::QAbstractLight::SpotLight);
+// spotLight.setColor(Qt::lightGray);
+// spotLight.setIntensity(0.5f);
+// spotLight.setLocalDirection(QVector3D(0, 0, -1));
+// spotLight.setCutOffAngle(0.75f);
+
+// QScopedPointer<Qt3DRender::QSpotLight> spotLightClone(static_cast<Qt3DRender::QSpotLight *>(QNode::clone(&spotLight)));
+// QVERIFY(spotLightClone.data());
+// QCOMPARE(spotLightClone->type(), Qt3DRender::QAbstractLight::SpotLight);
+// QCOMPARE(spotLight.color(), spotLightClone->color());
+// QCOMPARE(spotLight.intensity(), spotLightClone->intensity());
+// QCOMPARE(spotLight.localDirection(), spotLightClone->localDirection());
+// QCOMPARE(spotLight.cutOffAngle(), spotLightClone->cutOffAngle());
+// }
void checkLightPropertyUpdates()
{
@@ -264,13 +274,6 @@ private Q_SLOTS:
spotLightArbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QAbstractLight)
diff --git a/tests/auto/render/qattribute/tst_qattribute.cpp b/tests/auto/render/qattribute/tst_qattribute.cpp
index d0a468a4d..7c05927f2 100644
--- a/tests/auto/render/qattribute/tst_qattribute.cpp
+++ b/tests/auto/render/qattribute/tst_qattribute.cpp
@@ -29,15 +29,15 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/QAttribute>
+#include <Qt3DRender/private/qattribute_p.h>
#include <Qt3DRender/QBuffer>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QAttribute: public Qt3DCore::QNode
+class tst_QAttribute: public QObject
{
Q_OBJECT
public:
@@ -46,11 +46,6 @@ public:
qRegisterMetaType<Qt3DRender::QBuffer*>("Qt3DCore::QBuffer*");
}
- ~tst_QAttribute()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
-
private Q_SLOTS:
void checkCloning_data()
@@ -93,27 +88,28 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QAttribute *, attribute);
// WHEN
- Qt3DRender::QAttribute *clone = static_cast<Qt3DRender::QAttribute *>(QNode::clone(attribute));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(attribute);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(attribute->id(), clone->id());
- QCOMPARE(attribute->name(), clone->name());
- QCOMPARE(attribute->count(), clone->count());
- QCOMPARE(attribute->byteStride(), clone->byteStride());
- QCOMPARE(attribute->byteOffset(), clone->byteOffset());
- QCOMPARE(attribute->divisor(), clone->divisor());
- QCOMPARE(attribute->vertexBaseType(), clone->vertexBaseType());
- QCOMPARE(attribute->vertexSize(), clone->vertexSize());
- QVERIFY(attribute->attributeType() == clone->attributeType());
-
- if (attribute->buffer() != Q_NULLPTR) {
- QVERIFY(clone->buffer() != Q_NULLPTR);
- QVERIFY(attribute->buffer()->id() == clone->buffer()->id());
- QVERIFY(attribute->buffer()->type() == clone->buffer()->type());
- }
+ QCOMPARE(creationChanges.size(), 1 + (attribute->buffer() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QAttributeData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QAttributeData>>(creationChanges.first());
+ const Qt3DRender::QAttributeData &cloneData = creationChangeData->data;
+
+ QCOMPARE(attribute->id(), creationChangeData->subjectId());
+ QCOMPARE(attribute->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(attribute->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(attribute->name(), cloneData.name);
+ QCOMPARE(attribute->count(), cloneData.count);
+ QCOMPARE(attribute->byteStride(), cloneData.byteStride);
+ QCOMPARE(attribute->byteOffset(), cloneData.byteOffset);
+ QCOMPARE(attribute->divisor(), cloneData.divisor);
+ QCOMPARE(attribute->vertexBaseType(), cloneData.dataType);
+ QCOMPARE(attribute->vertexSize(), cloneData.dataSize);
+ QVERIFY(attribute->attributeType() == cloneData.attributeType);
+ QCOMPARE(attribute->buffer() ? attribute->buffer()->id() : Qt3DCore::QNodeId(), cloneData.bufferId);
}
void checkPropertyUpdates()
@@ -253,13 +249,6 @@ private Q_SLOTS:
QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QAttribute)
diff --git a/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp b/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp
index 615df7745..5a37d98a1 100644
--- a/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp
+++ b/tests/auto/render/qboundingvolumedebug/tst_qboundingvolumedebug.cpp
@@ -83,20 +83,21 @@ private Q_SLOTS:
QTest::newRow("recursive_bvd") << bvD;
}
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QBoundingVolumeDebug *, bvD);
-
- // WHEN
- Qt3DRender::QBoundingVolumeDebug *clone = static_cast<Qt3DRender::QBoundingVolumeDebug *>(QNode::clone(bvD));
- QCoreApplication::processEvents();
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(bvD->id(), clone->id());
- QCOMPARE(bvD->recursive(), clone->recursive());
- }
+ // TODO: Avoid cloning here
+// void checkCloning()
+// {
+// // GIVEN
+// QFETCH(Qt3DRender::QBoundingVolumeDebug *, bvD);
+
+// // WHEN
+// Qt3DRender::QBoundingVolumeDebug *clone = static_cast<Qt3DRender::QBoundingVolumeDebug *>(QNode::clone(bvD));
+// QCoreApplication::processEvents();
+
+// // THEN
+// QVERIFY(clone != Q_NULLPTR);
+// QCOMPARE(bvD->id(), clone->id());
+// QCOMPARE(bvD->recursive(), clone->recursive());
+// }
void checkPropertyUpdates()
{
@@ -161,14 +162,6 @@ private Q_SLOTS:
QCOMPARE(entity->children().count(), 2);
QCOMPARE(bvD->children().count(), 0);
}
-
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QBoundingVolumeDebug)
diff --git a/tests/auto/render/qbuffer/tst_qbuffer.cpp b/tests/auto/render/qbuffer/tst_qbuffer.cpp
index fdbc568b2..bfdf82f7f 100644
--- a/tests/auto/render/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/render/qbuffer/tst_qbuffer.cpp
@@ -29,8 +29,10 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/private/qbuffer_p.h>
#include <Qt3DRender/qbufferdatagenerator.h>
#include "testpostmanarbiter.h"
@@ -61,16 +63,9 @@ private:
int m_size;
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QBuffer: public Qt3DCore::QNode
+class tst_QBuffer: public QObject
{
Q_OBJECT
-public:
- ~tst_QBuffer()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -101,20 +96,29 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QBuffer *, buffer);
// WHEN
- Qt3DRender::QBuffer *clone = static_cast<Qt3DRender::QBuffer *>(QNode::clone(buffer));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(buffer);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(buffer->id(), clone->id());
- QCOMPARE(buffer->data(), clone->data());
- QCOMPARE(buffer->usage(), clone->usage());
- QCOMPARE(buffer->type(), clone->type());
- QCOMPARE(buffer->dataGenerator(), clone->dataGenerator());
- QCOMPARE(buffer->isSyncData(), clone->isSyncData());
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QBufferData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QBufferData>>(creationChanges.first());
+ const Qt3DRender::QBufferData &cloneData = creationChangeData->data;
+
+
+ QCOMPARE(buffer->id(), creationChangeData->subjectId());
+ QCOMPARE(buffer->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(buffer->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(buffer->data(), cloneData.data);
+ QCOMPARE(buffer->usage(), cloneData.usage);
+ QCOMPARE(buffer->type(), cloneData.type);
+ QCOMPARE(buffer->dataGenerator(), cloneData.functor);
+ QCOMPARE(buffer->isSyncData(), cloneData.syncData);
if (buffer->dataGenerator()) {
- QVERIFY(clone->dataGenerator());
- QVERIFY(*clone->dataGenerator() == *buffer->dataGenerator());
+ QVERIFY(cloneData.functor);
+ QVERIFY(*cloneData.functor == *buffer->dataGenerator());
+ QCOMPARE((*cloneData.functor)(), (*buffer->dataGenerator())());
}
}
@@ -185,13 +189,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QBuffer)
diff --git a/tests/auto/render/qcameraselector/tst_qcameraselector.cpp b/tests/auto/render/qcameraselector/tst_qcameraselector.cpp
index 895cffcf5..fc69f5adf 100644
--- a/tests/auto/render/qcameraselector/tst_qcameraselector.cpp
+++ b/tests/auto/render/qcameraselector/tst_qcameraselector.cpp
@@ -29,22 +29,17 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qcameraselector.h>
+#include <Qt3DRender/private/qcameraselector_p.h>
#include <Qt3DCore/qentity.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QCameraSelector: public Qt3DCore::QNode
+class tst_QCameraSelector: public QObject
{
Q_OBJECT
-public:
- ~tst_QCameraSelector()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -69,21 +64,22 @@ private Q_SLOTS:
QFETCH(Qt3DCore::QEntity *, camera);
// WHEN
- Qt3DRender::QCameraSelector *clone = static_cast<Qt3DRender::QCameraSelector *>(QNode::clone(cameraSelector));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(cameraSelector);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
+ QCOMPARE(creationChanges.size(), 1 + (camera ? 1 : 0));
- QCOMPARE(cameraSelector->id(), clone->id());
- if (cameraSelector->camera()) {
- QVERIFY(clone->camera());
- QCOMPARE(clone->camera()->id(), camera->id());
- } else {
- QVERIFY(clone->camera() == Q_NULLPTR);
- }
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QCameraSelectorData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QCameraSelectorData>>(creationChanges.first());
+ const Qt3DRender::QCameraSelectorData &cloneData = creationChangeData->data;
+
+ QCOMPARE(cameraSelector->id(), creationChangeData->subjectId());
+ QCOMPARE(cameraSelector->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(cameraSelector->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(cameraSelector->camera() ? cameraSelector->camera()->id() : Qt3DCore::QNodeId(), cloneData.cameraId);
delete cameraSelector;
- delete clone;
}
void checkPropertyUpdates()
@@ -139,13 +135,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QCameraSelector)
diff --git a/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp b/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp
index 9442ced90..3e4de55b0 100644
--- a/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp
+++ b/tests/auto/render/qclearbuffers/tst_qclearbuffers.cpp
@@ -29,21 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qclearbuffers.h>
+#include <Qt3DRender/private/qclearbuffers_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QClearBuffers: public Qt3DCore::QNode
+class tst_QClearBuffers: public QObject
{
Q_OBJECT
-public:
- ~tst_QClearBuffers()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -78,15 +73,26 @@ private Q_SLOTS:
QCOMPARE(clearBuffers->buffers(), bufferType);
// WHEN
- Qt3DRender::QClearBuffers *clone = static_cast<Qt3DRender::QClearBuffers *>(QNode::clone(clearBuffers));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(clearBuffers);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QClearBuffersData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QClearBuffersData>>(creationChanges.first());
+ const Qt3DRender::QClearBuffersData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(clearBuffers->id(), clone->id());
- QCOMPARE(clearBuffers->buffers(), clone->buffers());
+ QCOMPARE(clearBuffers->id(), creationChangeData->subjectId());
+ QCOMPARE(clearBuffers->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(clearBuffers->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(clearBuffers->buffers(), cloneData.buffersType);
+ QCOMPARE(clearBuffers->clearColor(), cloneData.clearColor);
+ QCOMPARE(clearBuffers->clearDepthValue(), cloneData.clearDepthValue);
+ QCOMPARE(clearBuffers->clearStencilValue(), cloneData.clearStencilValue);
delete clearBuffers;
- delete clone;
}
void checkPropertyUpdates()
@@ -130,13 +136,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QClearBuffers)
diff --git a/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp b/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp
index cc20200ab..97d9a459f 100644
--- a/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp
+++ b/tests/auto/render/qdefaultmeshes/tst_qdefaultmeshes.cpp
@@ -34,6 +34,11 @@
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
#include <Qt3DRender/qbufferdatagenerator.h>
+#include <Qt3DRender/private/qgeometryrenderer_p.h>
+#include <Qt3DRender/private/qgeometry_p.h>
+#include <Qt3DRender/private/qattribute_p.h>
+#include <Qt3DRender/private/qbuffer_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DExtras/qspheremesh.h>
#include <Qt3DExtras/qcylindermesh.h>
@@ -41,16 +46,10 @@
#include <Qt3DExtras/qcuboidmesh.h>
#include <Qt3DExtras/qplanemesh.h>
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QDefaultMeshes: public Qt3DCore::QNode
+
+class tst_QDefaultMeshes: public QObject
{
Q_OBJECT
-public:
- ~tst_QDefaultMeshes()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -70,69 +69,31 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QGeometryRenderer *, geomRenderer);
// WHEN
- QScopedPointer<Qt3DRender::QGeometryRenderer> clone(static_cast<Qt3DRender::QGeometryRenderer *>(QNode::clone(geomRenderer)));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geomRenderer);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(clone->id(), geomRenderer->id());
- QCOMPARE(clone->instanceCount(), geomRenderer->instanceCount());
- QCOMPARE(clone->vertexCount(), geomRenderer->vertexCount());
- QCOMPARE(clone->indexOffset(), geomRenderer->indexOffset());
- QCOMPARE(clone->firstInstance(), geomRenderer->firstInstance());
- QCOMPARE(clone->restartIndexValue(), geomRenderer->restartIndexValue());
- QCOMPARE(clone->primitiveRestartEnabled(), geomRenderer->primitiveRestartEnabled());
- QCOMPARE(clone->primitiveType(), geomRenderer->primitiveType());
+ QVERIFY(creationChanges.size() >= 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QGeometryRendererData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QGeometryRendererData>>(creationChanges.first());
+ const Qt3DRender::QGeometryRendererData &cloneData = creationChangeData->data;
+
+ QCOMPARE(creationChangeData->subjectId(), geomRenderer->id());
+ QCOMPARE(cloneData.instanceCount, geomRenderer->instanceCount());
+ QCOMPARE(cloneData.vertexCount, geomRenderer->vertexCount());
+ QCOMPARE(cloneData.indexOffset, geomRenderer->indexOffset());
+ QCOMPARE(cloneData.firstInstance, geomRenderer->firstInstance());
+ QCOMPARE(cloneData.restartIndexValue, geomRenderer->restartIndexValue());
+ QCOMPARE(cloneData.primitiveRestart, geomRenderer->primitiveRestartEnabled());
+ QCOMPARE(cloneData.primitiveType, geomRenderer->primitiveType());
+ QCOMPARE(cloneData.geometryFactory, geomRenderer->geometryFactory());
- QCOMPARE(clone->geometryFactory(), geomRenderer->geometryFactory());
if (geomRenderer->geometryFactory()) {
- QVERIFY(clone->geometryFactory());
- QVERIFY(*clone->geometryFactory() == *geomRenderer->geometryFactory());
- }
-
- if (geomRenderer->geometry() != Q_NULLPTR) {
- QVERIFY(clone->geometry() != Q_NULLPTR);
- QCOMPARE(clone->geometry()->id(), geomRenderer->geometry()->id());
-
- const Qt3DRender::QGeometry *geometry = geomRenderer->geometry();
- const Qt3DRender::QGeometry *clonedGeometry = clone->geometry();
-
- QCOMPARE(clonedGeometry->attributes().count(), geometry->attributes().count());
-
- for (int i = 0; i < geometry->attributes().count(); ++i) {
- const Qt3DRender::QAttribute *originalAttribute = static_cast<Qt3DRender::QAttribute *>(geometry->attributes().at(i));
- const Qt3DRender::QAttribute *cloneAttribute = static_cast<Qt3DRender::QAttribute *>(clonedGeometry->attributes().at(i));
-
- QCOMPARE(originalAttribute->id(), cloneAttribute->id());
- QCOMPARE(originalAttribute->name(), cloneAttribute->name());
- QCOMPARE(originalAttribute->count(), cloneAttribute->count());
- QCOMPARE(originalAttribute->byteStride(), cloneAttribute->byteStride());
- QCOMPARE(originalAttribute->byteOffset(), cloneAttribute->byteOffset());
- QCOMPARE(originalAttribute->divisor(), cloneAttribute->divisor());
- QCOMPARE(originalAttribute->attributeType(), cloneAttribute->attributeType());
-
- const Qt3DRender::QBuffer *buffer = originalAttribute->buffer();
- const Qt3DRender::QBuffer *clonedBuffer = cloneAttribute->buffer();
- QCOMPARE(buffer->id(), clonedBuffer->id());
- QCOMPARE(buffer->data(), clonedBuffer->data());
- QCOMPARE(buffer->usage(), clonedBuffer->usage());
- QCOMPARE(buffer->type(), clonedBuffer->type());
- QCOMPARE(buffer->dataGenerator(), clonedBuffer->dataGenerator());
- QCOMPARE(buffer->isSyncData(), clonedBuffer->isSyncData());
- if (buffer->dataGenerator()) {
- QVERIFY(clonedBuffer->dataGenerator());
- QVERIFY(*clonedBuffer->dataGenerator() == *buffer->dataGenerator());
- }
- }
+ QVERIFY(cloneData.geometryFactory);
+ QVERIFY(*cloneData.geometryFactory == *geomRenderer->geometryFactory());
}
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QDefaultMeshes)
diff --git a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
index 9b3a35521..5b15d73c2 100644
--- a/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
+++ b/tests/auto/render/qframegraphnode/tst_qframegraphnode.cpp
@@ -30,8 +30,10 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qframegraphnode.h>
+#include <Qt3DRender/private/qframegraphnode_p.h>
#include "testpostmanarbiter.h"
@@ -43,21 +45,11 @@ public:
: QFrameGraphNode(parent)
{
}
-
-private:
- QT3D_CLONEABLE(MyFrameGraphNode)
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QFrameGraphNode: public Qt3DCore::QNode
+class tst_QFrameGraphNode: public QObject
{
Q_OBJECT
-public:
- ~tst_QFrameGraphNode()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -92,15 +84,19 @@ private Q_SLOTS:
QCOMPARE(frameGraphNode->isEnabled(), enabled);
// WHEN
- Qt3DRender::QFrameGraphNode *clone = static_cast<Qt3DRender::QFrameGraphNode *>(QNode::clone(frameGraphNode));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(frameGraphNode);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(frameGraphNode->id(), clone->id());
- QCOMPARE(frameGraphNode->isEnabled(), enabled);
+ QCOMPARE(creationChanges.size(), 1);
+ const Qt3DCore::QNodeCreatedChangeBasePtr creationChangeData = creationChanges.first();
+
+ // THEN
+ QCOMPARE(frameGraphNode->id(), creationChangeData->subjectId());
+ QCOMPARE(frameGraphNode->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(frameGraphNode->metaObject(), creationChangeData->metaObject());
delete frameGraphNode;
- delete clone;
}
void checkPropertyUpdates()
@@ -185,13 +181,6 @@ private Q_SLOTS:
QVERIFY(child211->parent() == child21);
QVERIFY(child211->parentFrameGraphNode() == child2);
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QFrameGraphNode)
diff --git a/tests/auto/render/qgeometry/tst_qgeometry.cpp b/tests/auto/render/qgeometry/tst_qgeometry.cpp
index 8dcc6f9df..c284e85c4 100644
--- a/tests/auto/render/qgeometry/tst_qgeometry.cpp
+++ b/tests/auto/render/qgeometry/tst_qgeometry.cpp
@@ -29,8 +29,10 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qgeometry.h>
+#include <Qt3DRender/private/qgeometry_p.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
@@ -40,9 +42,7 @@
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QGeometry: public Qt3DCore::QNode
+class tst_QGeometry: public QObject
{
Q_OBJECT
@@ -80,29 +80,28 @@ private Q_SLOTS:
QFETCH(int, attributeCount);
// WHEN
- Qt3DRender::QGeometry *clone = static_cast<Qt3DRender::QGeometry *>(QNode::clone(geometry));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geometry);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
+ QCOMPARE(creationChanges.size(), 1 + geometry->childNodes().size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QGeometryData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QGeometryData>>(creationChanges.first());
+ const Qt3DRender::QGeometryData &cloneData = creationChangeData->data;
+
+ QCOMPARE(geometry->id(), creationChangeData->subjectId());
+ QCOMPARE(geometry->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(geometry->metaObject(), creationChangeData->metaObject());
- QCOMPARE(geometry->id(), clone->id());
QCOMPARE(attributeCount, geometry->attributes().count());
- QCOMPARE(attributeCount, clone->attributes().count());
+ QCOMPARE(attributeCount, cloneData.attributeIds.count());
if (geometry->boundingVolumePositionAttribute())
- QCOMPARE(geometry->boundingVolumePositionAttribute()->id(), clone->boundingVolumePositionAttribute()->id());
+ QCOMPARE(geometry->boundingVolumePositionAttribute()->id(), cloneData.boundingVolumePositionAttributeId);
for (int i = 0; i < attributeCount; ++i) {
Qt3DRender::QAttribute *originalAttribute = static_cast<Qt3DRender::QAttribute *>(geometry->attributes()[i]);
- Qt3DRender::QAttribute *cloneAttribute = static_cast<Qt3DRender::QAttribute *>(clone->attributes()[i]);
-
- QCOMPARE(originalAttribute->id(), cloneAttribute->id());
- QCOMPARE(originalAttribute->name(), cloneAttribute->name());
- QCOMPARE(originalAttribute->buffer(), cloneAttribute->buffer());
- QCOMPARE(originalAttribute->count(), cloneAttribute->count());
- QCOMPARE(originalAttribute->byteStride(), cloneAttribute->byteStride());
- QCOMPARE(originalAttribute->byteOffset(), cloneAttribute->byteOffset());
- QCOMPARE(originalAttribute->divisor(), cloneAttribute->divisor());
- QCOMPARE(originalAttribute->attributeType(), cloneAttribute->attributeType());
+ QCOMPARE(originalAttribute->id(), cloneData.attributeIds.at(i));
}
}
@@ -146,13 +145,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QGeometry)
diff --git a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp
index c025619ad..626066a0d 100644
--- a/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp
+++ b/tests/auto/render/qgeometryrenderer/tst_qgeometryrenderer.cpp
@@ -29,12 +29,14 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qgeometryrenderer.h>
#include <Qt3DRender/qgeometryfactory.h>
#include <Qt3DRender/qgeometry.h>
#include <Qt3DRender/qattribute.h>
#include <Qt3DRender/qbuffer.h>
+#include <Qt3DRender/private/qgeometryrenderer_p.h>
#include <Qt3DCore/QNodePropertyChange>
#include <Qt3DCore/QNodeAddedPropertyChange>
@@ -68,9 +70,7 @@ private:
int m_size;
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QGeometryRenderer: public Qt3DCore::QNode
+class tst_QGeometryRenderer: public QObject
{
Q_OBJECT
@@ -116,31 +116,35 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QGeometryRenderer *, geometryRenderer);
// WHEN
- Qt3DRender::QGeometryRenderer *clone = static_cast<Qt3DRender::QGeometryRenderer *>(QNode::clone(geometryRenderer));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(geometryRenderer);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
-
- QCOMPARE(clone->id(), geometryRenderer->id());
- QCOMPARE(clone->instanceCount(), geometryRenderer->instanceCount());
- QCOMPARE(clone->vertexCount(), geometryRenderer->vertexCount());
- QCOMPARE(clone->indexOffset(), geometryRenderer->indexOffset());
- QCOMPARE(clone->firstInstance(), geometryRenderer->firstInstance());
- QCOMPARE(clone->restartIndexValue(), geometryRenderer->restartIndexValue());
- QCOMPARE(clone->primitiveRestartEnabled(), geometryRenderer->primitiveRestartEnabled());
- QCOMPARE(clone->primitiveType(), geometryRenderer->primitiveType());
- QCOMPARE(clone->verticesPerPatch(), geometryRenderer->verticesPerPatch());
-
- if (geometryRenderer->geometry() != Q_NULLPTR) {
- QVERIFY(clone->geometry() != Q_NULLPTR);
- QCOMPARE(clone->geometry()->id(), geometryRenderer->geometry()->id());
- }
-
- QCOMPARE(clone->geometryFactory(), geometryRenderer->geometryFactory());
- if (geometryRenderer->geometryFactory()) {
- QVERIFY(clone->geometryFactory());
- QVERIFY(*clone->geometryFactory() == *geometryRenderer->geometryFactory());
- }
+ QCOMPARE(creationChanges.size(), 1 + (geometryRenderer->geometry() ? 1 : 0));
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QGeometryRendererData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QGeometryRendererData>>(creationChanges.first());
+ const Qt3DRender::QGeometryRendererData &cloneData = creationChangeData->data;
+
+ QCOMPARE(geometryRenderer->id(), creationChangeData->subjectId());
+ QCOMPARE(geometryRenderer->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(geometryRenderer->metaObject(), creationChangeData->metaObject());
+
+ QCOMPARE(cloneData.instanceCount, geometryRenderer->instanceCount());
+ QCOMPARE(cloneData.vertexCount, geometryRenderer->vertexCount());
+ QCOMPARE(cloneData.indexOffset, geometryRenderer->indexOffset());
+ QCOMPARE(cloneData.firstInstance, geometryRenderer->firstInstance());
+ QCOMPARE(cloneData.restartIndexValue, geometryRenderer->restartIndexValue());
+ QCOMPARE(cloneData.primitiveRestart, geometryRenderer->primitiveRestartEnabled());
+ QCOMPARE(cloneData.primitiveType, geometryRenderer->primitiveType());
+ QCOMPARE(cloneData.verticesPerPatch, geometryRenderer->verticesPerPatch());
+
+ if (geometryRenderer->geometry() != Q_NULLPTR)
+ QCOMPARE(cloneData.geometryId, geometryRenderer->geometry()->id());
+
+ QCOMPARE(cloneData.geometryFactory, geometryRenderer->geometryFactory());
+ if (geometryRenderer->geometryFactory())
+ QVERIFY(*cloneData.geometryFactory == *geometryRenderer->geometryFactory());
}
void checkPropertyUpdates()
@@ -300,13 +304,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QGeometryRenderer)
diff --git a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp
index 175285a69..8ace74d30 100644
--- a/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp
+++ b/tests/auto/render/qlayerfilter/tst_qlayerfilter.cpp
@@ -29,21 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qlayerfilter.h>
+#include <Qt3DRender/private/qlayerfilter_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QLayerFilter: public Qt3DCore::QNode
+class tst_QLayerFilter: public QObject
{
Q_OBJECT
-public:
- ~tst_QLayerFilter()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -76,15 +71,24 @@ private Q_SLOTS:
QCOMPARE(layerFilter->layers(), layerNames);
// WHEN
- Qt3DRender::QLayerFilter *clone = static_cast<Qt3DRender::QLayerFilter *>(QNode::clone(layerFilter));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(layerFilter);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QLayerFilterData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QLayerFilterData>>(creationChanges.first());
+ const Qt3DRender::QLayerFilterData &cloneData = creationChangeData->data;
+
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(layerFilter->id(), clone->id());
- QCOMPARE(layerFilter->layers(), clone->layers());
+ QCOMPARE(layerFilter->id(), creationChangeData->subjectId());
+ QCOMPARE(layerFilter->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(layerFilter->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(layerFilter->layers(), cloneData.layers);
delete layerFilter;
- delete clone;
}
void checkPropertyUpdates()
@@ -145,13 +149,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QLayerFilter)
diff --git a/tests/auto/render/qmaterial/tst_qmaterial.cpp b/tests/auto/render/qmaterial/tst_qmaterial.cpp
index b831589f5..638f774e3 100644
--- a/tests/auto/render/qmaterial/tst_qmaterial.cpp
+++ b/tests/auto/render/qmaterial/tst_qmaterial.cpp
@@ -33,6 +33,7 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DRender/private/qrenderstate_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/QEffect>
#include <Qt3DRender/QMaterial>
@@ -47,6 +48,8 @@
#include <Qt3DExtras/QNormalDiffuseMapAlphaMaterial>
#include <Qt3DExtras/QNormalDiffuseSpecularMapMaterial>
+#include <Qt3DRender/private/qmaterial_p.h>
+
#include "testpostmanarbiter.h"
class TestMaterial : public Qt3DRender::QMaterial
@@ -71,14 +74,12 @@ public:
Qt3DRender::QShaderProgram *m_shaderProgram;
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QMaterial : public Qt3DCore::QNode
+class tst_QMaterial : public QObject
{
Q_OBJECT
public:
tst_QMaterial()
- : Qt3DCore::QNode()
+ : QObject()
{
qRegisterMetaType<Qt3DRender::QEffect*>("Qt3DRender::QEffect*");
}
@@ -216,13 +217,29 @@ private Q_SLOTS:
QFETCH(Qt3DRender::QMaterial *, material);
// WHEN
- Qt3DRender::QMaterial *clone = static_cast<Qt3DRender::QMaterial *>(QNode::clone(material));
- QCoreApplication::processEvents();
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(material);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QVERIFY(creationChanges.size() >= 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QMaterialData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QMaterialData>>(creationChanges.first());
+ const Qt3DRender::QMaterialData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(clone != Q_NULLPTR);
- compareParameters(material->parameters(), clone->parameters());
- compareEffects(material->effect(), clone->effect());
+ QCOMPARE(material->id(), creationChangeData->subjectId());
+ QCOMPARE(material->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(material->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(material->effect() ? material->effect()->id() : Qt3DCore::QNodeId(), cloneData.effectId);
+ QCOMPARE(material->parameters().size(), cloneData.parameterIds.size());
+
+ for (int i = 0, m = material->parameters().size(); i < m; ++i)
+ QCOMPARE(material->parameters().at(i)->id(), cloneData.parameterIds.at(i));
+
+ // TO DO: Add unit tests for parameter and effect that do check this
+ // compareParameters(material->parameters(), clone->parameters());
+ // compareEffects(material->effect(), clone->effect());
}
void checkEffectUpdate()
@@ -414,13 +431,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QMaterial)
diff --git a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
index 84e164778..c2100268f 100644
--- a/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
+++ b/tests/auto/render/qobjectpicker/tst_qobjectpicker.cpp
@@ -83,22 +83,23 @@ private Q_SLOTS:
QTest::newRow("objectPicker_all_true") << objectPicker;
}
- void checkCloning()
- {
- // GIVEN
- QFETCH(Qt3DRender::QObjectPicker *, objectPicker);
-
- // WHEN
- Qt3DRender::QObjectPicker *clone = static_cast<Qt3DRender::QObjectPicker *>(QNode::clone(objectPicker));
- QCoreApplication::processEvents();
-
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(objectPicker->id(), clone->id());
- QCOMPARE(objectPicker->isHoverEnabled(), clone->isHoverEnabled());
- QCOMPARE(objectPicker->isPressed(), clone->isPressed());
- QCOMPARE(objectPicker->containsMouse(), clone->containsMouse());
- }
+ // TODO: Avoid cloning here
+// void checkCloning()
+// {
+// // GIVEN
+// QFETCH(Qt3DRender::QObjectPicker *, objectPicker);
+
+// // WHEN
+// Qt3DRender::QObjectPicker *clone = static_cast<Qt3DRender::QObjectPicker *>(QNode::clone(objectPicker));
+// QCoreApplication::processEvents();
+
+// // THEN
+// QVERIFY(clone != Q_NULLPTR);
+// QCOMPARE(objectPicker->id(), clone->id());
+// QCOMPARE(objectPicker->isHoverEnabled(), clone->isHoverEnabled());
+// QCOMPARE(objectPicker->isPressed(), clone->isPressed());
+// QCOMPARE(objectPicker->containsMouse(), clone->containsMouse());
+// }
void checkPropertyUpdates()
{
@@ -178,14 +179,6 @@ private Q_SLOTS:
// Check that the QObjectPicker triggers the expected signal
QCOMPARE(spy.count(), 1);
}
-
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QObjectPicker)
diff --git a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp
index 4e3b217dc..3d4d885d6 100644
--- a/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp
+++ b/tests/auto/render/qrenderpassfilter/tst_qrenderpassfilter.cpp
@@ -30,8 +30,10 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qrenderpassfilter.h>
+#include <Qt3DRender/private/qrenderpassfilter_p.h>
#include <Qt3DRender/qparameter.h>
#include <Qt3DRender/qfilterkey.h>
@@ -41,16 +43,9 @@
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QRenderPassFilter: public Qt3DCore::QNode
+class tst_QRenderPassFilter: public QObject
{
Q_OBJECT
-public:
- ~tst_QRenderPassFilter()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -109,6 +104,7 @@ private Q_SLOTS:
QTest::newRow("renderPassFilterWithParamsAndAnnotations") << renderPassFilterWithParamsAndAnnotations << params2 << filterKeys2 ;
}
+ // TODO: Avoid cloning here
void checkCloning()
{
// GIVEN
@@ -121,37 +117,28 @@ private Q_SLOTS:
QCOMPARE(renderPassFilter->matchAny(), filterKeys);
// WHEN
- Qt3DRender::QRenderPassFilter *clone = static_cast<Qt3DRender::QRenderPassFilter *>(QNode::clone(renderPassFilter));
+ // WHEN
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(renderPassFilter);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+ // THEN
+ QCOMPARE(creationChanges.size(), 1 + renderPassFilter->parameters().size() + renderPassFilter->matchAny().size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QRenderPassFilterData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QRenderPassFilterData>>(creationChanges.first());
+ const Qt3DRender::QRenderPassFilterData &cloneData = creationChangeData->data;
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(renderPassFilter->id(), clone->id());
-
- QCOMPARE(renderPassFilter->matchAny().count(), clone->matchAny().count());
- QCOMPARE(renderPassFilter->parameters().count(), clone->parameters().count());
-
- for (int i = 0, m = parameters.count(); i < m; ++i) {
- Qt3DRender::QParameter *pClone = clone->parameters().at(i);
- Qt3DRender::QParameter *pOrig = parameters.at(i);
- QCOMPARE(pOrig->id(),pClone->id());
- QCOMPARE(pOrig->name(), pClone->name());
- QCOMPARE(pOrig->value(), pClone->value());
- QVERIFY(pClone->parent() == clone);
- QVERIFY(pOrig->parent() == renderPassFilter);
- }
-
- for (int i = 0, m = filterKeys.count(); i < m; ++i) {
- Qt3DRender::QFilterKey *aClone = clone->matchAny().at(i);
- Qt3DRender::QFilterKey *aOrig = filterKeys.at(i);
- QCOMPARE(aOrig->id(),aClone->id());
- QCOMPARE(aOrig->name(), aClone->name());
- QCOMPARE(aOrig->value(), aClone->value());
- QVERIFY(aClone->parent() == clone);
- QVERIFY(aOrig->parent() == renderPassFilter);
- }
+ QCOMPARE(renderPassFilter->id(), creationChangeData->subjectId());
+ QCOMPARE(renderPassFilter->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(renderPassFilter->metaObject(), creationChangeData->metaObject());
+
+ QCOMPARE(renderPassFilter->matchAny().count(), cloneData.matchIds.count());
+ QCOMPARE(renderPassFilter->parameters().count(), cloneData.parameterIds.count());
+
+ // TO DO: Add unit tests for QParameter / QFilterKey
delete renderPassFilter;
- delete clone;
}
void checkPropertyUpdates()
@@ -232,13 +219,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QRenderPassFilter)
diff --git a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp
index 7cd08c1ec..2c03df736 100644
--- a/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp
+++ b/tests/auto/render/qrenderstateset/tst_qrenderstateset.cpp
@@ -30,10 +30,12 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qrenderstateset.h>
#include <Qt3DRender/private/qrenderstate_p.h>
#include <Qt3DRender/qrenderstate.h>
+#include <Qt3DRender/private/qrenderstateset_p.h>
#include <Qt3DCore/qnodepropertychange.h>
#include <Qt3DCore/qnodeaddedpropertychange.h>
@@ -60,27 +62,18 @@ public:
{}
private:
- QT3D_CLONEABLE(MyStateSet)
Q_DECLARE_PRIVATE(MyStateSet)
};
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QRenderStateSet: public Qt3DCore::QNode
+class tst_QRenderStateSet: public QObject
{
Q_OBJECT
-public:
- ~tst_QRenderStateSet()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
void checkSaneDefaults()
{
QScopedPointer<Qt3DRender::QRenderStateSet> defaultstateSet(new Qt3DRender::QRenderStateSet);
-
QVERIFY(defaultstateSet->renderStates().isEmpty());
}
@@ -111,24 +104,27 @@ private Q_SLOTS:
QCOMPARE(stateSet->renderStates(), states);
// WHEN
- Qt3DRender::QRenderStateSet *clone = static_cast<Qt3DRender::QRenderStateSet *>(QNode::clone(stateSet));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(stateSet);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(stateSet->id(), clone->id());
+ QCOMPARE(creationChanges.size(), 1 + states.size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QRenderStateSetData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QRenderStateSetData>>(creationChanges.first());
+ const Qt3DRender::QRenderStateSetData &cloneData = creationChangeData->data;
- QCOMPARE(stateSet->renderStates().count(), clone->renderStates().count());
+ QCOMPARE(stateSet->id(), creationChangeData->subjectId());
+ QCOMPARE(stateSet->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(stateSet->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(stateSet->renderStates().count(), cloneData.renderStateIds.count());
for (int i = 0, m = states.count(); i < m; ++i) {
- Qt3DRender::QRenderState *sClone = clone->renderStates().at(i);
Qt3DRender::QRenderState *sOrig = states.at(i);
- QCOMPARE(sOrig->id(),sClone->id());
- QVERIFY(sClone->parent() == clone);
- QVERIFY(sOrig->parent() == stateSet);
+ QCOMPARE(sOrig->id(), cloneData.renderStateIds.at(i));
}
delete stateSet;
- delete clone;
}
void checkPropertyUpdates()
@@ -173,13 +169,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QRenderStateSet)
diff --git a/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp b/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp
index bbe28f85f..4f1494c78 100644
--- a/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp
+++ b/tests/auto/render/qrendertargetselector/tst_qrendertargetselector.cpp
@@ -30,21 +30,16 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qrendertargetselector.h>
+#include <Qt3DRender/private/qrendertargetselector_p.h>
#include <Qt3DRender/qrendertarget.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QRenderTargetSelector: public Qt3DCore::QNode
+class tst_QRenderTargetSelector: public QObject
{
Q_OBJECT
-public:
- ~tst_QRenderTargetSelector()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -90,21 +85,23 @@ private Q_SLOTS:
QCOMPARE(renderTargetSelector->target(), target);
// WHEN
- Qt3DRender::QRenderTargetSelector *clone = static_cast<Qt3DRender::QRenderTargetSelector *>(QNode::clone(renderTargetSelector));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(renderTargetSelector);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(renderTargetSelector->id(), clone->id());
+ QCOMPARE(creationChanges.size(), 1 + (renderTargetSelector->target() ? 1 : 0));
- QCOMPARE(renderTargetSelector->outputs(), clone->outputs());
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QRenderTargetSelectorData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QRenderTargetSelectorData>>(creationChanges.first());
+ const Qt3DRender::QRenderTargetSelectorData &cloneData = creationChangeData->data;
- if (renderTargetSelector->target() != Q_NULLPTR) {
- QVERIFY(clone->target() != Q_NULLPTR);
- QCOMPARE(clone->target()->id(), renderTargetSelector->target()->id());
- }
+ // THEN
+ QCOMPARE(renderTargetSelector->id(), creationChangeData->subjectId());
+ QCOMPARE(renderTargetSelector->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(renderTargetSelector->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(renderTargetSelector->target() ? renderTargetSelector->target()->id() : Qt3DCore::QNodeId(), cloneData.targetId);
delete renderTargetSelector;
- delete clone;
}
void checkPropertyUpdates()
@@ -187,13 +184,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QRenderTargetSelector)
diff --git a/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp b/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp
index eb202132b..bac9fb3e8 100644
--- a/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp
+++ b/tests/auto/render/qsortcriterion/tst_qsortcriterion.cpp
@@ -29,21 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qsortcriterion.h>
+#include <Qt3DRender/private/qsortcriterion_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QSortCriterion: public Qt3DCore::QNode
+class tst_QSortCriterion: public QObject
{
Q_OBJECT
-public:
- ~tst_QSortCriterion()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -73,16 +68,26 @@ private Q_SLOTS:
// THEN
QCOMPARE(sortCriterion->sort(), sortType);
- // WHEN
- Qt3DRender::QSortCriterion *clone = static_cast<Qt3DRender::QSortCriterion *>(QNode::clone(sortCriterion));
+// TO DO: Add creation change
+// // WHEN
+// Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(sortCriterion);
+// QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
+
+// // THEN
+// QCOMPARE(creationChanges.size(), 1);
+
+// const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QCameraSelectorData> creationChangeData =
+// qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QSortCriterion>>(creationChanges.first());
+// const Qt3DRender::QCameraSelectorData &cloneData = creationChangeData->data;
- // THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(sortCriterion->id(), clone->id());
- QCOMPARE(sortCriterion->sort(), clone->sort());
+
+// // THEN
+// QCOMPARE(sortCriterion->id(), creationChangeData->subjectId());
+// QCOMPARE(sortCriterion->isEnabled(), creationChangeData->isNodeEnabled());
+// QCOMPARE(sortCriterion->metaObject(), creationChangeData->metaObject());
+// QCOMPARE(sortCriterion->sort(), cloneData.sort);
delete sortCriterion;
- delete clone;
}
void checkPropertyUpdates()
@@ -126,13 +131,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QSortCriterion)
diff --git a/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp b/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp
index 092149c49..bd419f0e1 100644
--- a/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp
+++ b/tests/auto/render/qsortpolicy/tst_qsortpolicy.cpp
@@ -30,8 +30,10 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qsortpolicy.h>
+#include <Qt3DRender/private/qsortpolicy_p.h>
#include "testpostmanarbiter.h"
@@ -82,34 +84,33 @@ private Q_SLOTS:
QCOMPARE(sortPolicy->sortTypes(), sortTypes);
// WHEN
- Qt3DRender::QSortPolicy *clone = static_cast<Qt3DRender::QSortPolicy *>(QNode::clone(sortPolicy));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(sortPolicy);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(sortPolicy->id(), clone->id());
+ QCOMPARE(creationChanges.size(), 1);
- QCOMPARE(sortPolicy->sortTypes().count(), clone->sortTypes().count());
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QSortPolicyData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QSortPolicyData>>(creationChanges.first());
+ const Qt3DRender::QSortPolicyData &cloneData = creationChangeData->data;
- for (int i = 0, m = sortTypes.count(); i < m; ++i) {
- Qt3DRender::QSortPolicy::SortType cClone = clone->sortTypes().at(i);
- Qt3DRender::QSortPolicy::SortType cOrig = sortTypes.at(i);
- QCOMPARE(cOrig,cClone);
- }
+ QCOMPARE(sortPolicy->id(), creationChangeData->subjectId());
+ QCOMPARE(sortPolicy->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(sortPolicy->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(sortPolicy->sortTypes().count(), cloneData.sortTypes.count());
+ QCOMPARE(sortPolicy->sortTypes(), cloneData.sortTypes);
delete sortPolicy;
- delete clone;
}
void checkPropertyUpdates()
{
- QSKIP("Wait for cloning mechanism to be fixed");
-
// GIVEN
QScopedPointer<Qt3DRender::QSortPolicy> sortPolicy(new Qt3DRender::QSortPolicy());
TestArbiter arbiter(sortPolicy.data());
// WHEN
- Qt3DRender::QSortPolicy::SortType sortType1;
+ Qt3DRender::QSortPolicy::SortType sortType1 = Qt3DRender::QSortPolicy::BackToFront;
sortPolicy->addSortType(sortType1);
QCoreApplication::processEvents();
@@ -144,13 +145,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QSortPolicy)
diff --git a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp
index 1a3109c47..6b6e849d7 100644
--- a/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp
+++ b/tests/auto/render/qtechniquefilter/tst_qtechniquefilter.cpp
@@ -30,8 +30,10 @@
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
#include <Qt3DCore/qentity.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qtechniquefilter.h>
+#include <Qt3DRender/private/qtechniquefilter_p.h>
#include <Qt3DRender/qparameter.h>
#include <Qt3DRender/qfilterkey.h>
@@ -41,16 +43,9 @@
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QTechniqueFilter: public Qt3DCore::QNode
+class tst_QTechniqueFilter: public QObject
{
Q_OBJECT
-public:
- ~tst_QTechniqueFilter()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -121,37 +116,34 @@ private Q_SLOTS:
QCOMPARE(techniqueFilter->matchAll(), filterKeys);
// WHEN
- Qt3DRender::QTechniqueFilter *clone = static_cast<Qt3DRender::QTechniqueFilter *>(QNode::clone(techniqueFilter));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(techniqueFilter);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(techniqueFilter->id(), clone->id());
+ QCOMPARE(creationChanges.size(), 1 + parameters.size() + filterKeys.size());
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QTechniqueFilterData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QTechniqueFilterData>>(creationChanges.first());
+ const Qt3DRender::QTechniqueFilterData &cloneData = creationChangeData->data;
+
+ QCOMPARE(techniqueFilter->id(), creationChangeData->subjectId());
+ QCOMPARE(techniqueFilter->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(techniqueFilter->metaObject(), creationChangeData->metaObject());
- QCOMPARE(techniqueFilter->matchAll().count(), clone->matchAll().count());
- QCOMPARE(techniqueFilter->parameters().count(), clone->parameters().count());
+ QCOMPARE(techniqueFilter->matchAll().count(), cloneData.matchIds.count());
+ QCOMPARE(techniqueFilter->parameters().count(), cloneData.parameterIds.count());
for (int i = 0, m = parameters.count(); i < m; ++i) {
- Qt3DRender::QParameter *pClone = clone->parameters().at(i);
Qt3DRender::QParameter *pOrig = parameters.at(i);
- QCOMPARE(pOrig->id(),pClone->id());
- QCOMPARE(pOrig->name(), pClone->name());
- QCOMPARE(pOrig->value(), pClone->value());
- QVERIFY(pClone->parent() == clone);
- QVERIFY(pOrig->parent() == techniqueFilter);
+ QCOMPARE(pOrig->id(), cloneData.parameterIds.at(i));
}
for (int i = 0, m = filterKeys.count(); i < m; ++i) {
- Qt3DRender::QFilterKey *aClone = clone->matchAll().at(i);
Qt3DRender::QFilterKey *aOrig = filterKeys.at(i);
- QCOMPARE(aOrig->id(),aClone->id());
- QCOMPARE(aOrig->name(), aClone->name());
- QCOMPARE(aOrig->value(), aClone->value());
- QVERIFY(aClone->parent() == clone);
- QVERIFY(aOrig->parent() == techniqueFilter);
+ QCOMPARE(aOrig->id(), cloneData.matchIds.at(i));
}
delete techniqueFilter;
- delete clone;
}
void checkPropertyUpdates()
@@ -232,13 +224,6 @@ private Q_SLOTS:
arbiter.events.clear();
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QTechniqueFilter)
diff --git a/tests/auto/render/qviewport/tst_qviewport.cpp b/tests/auto/render/qviewport/tst_qviewport.cpp
index 88b54cac6..30c3bcccc 100644
--- a/tests/auto/render/qviewport/tst_qviewport.cpp
+++ b/tests/auto/render/qviewport/tst_qviewport.cpp
@@ -29,21 +29,16 @@
#include <QtTest/QTest>
#include <Qt3DCore/private/qnode_p.h>
#include <Qt3DCore/private/qscene_p.h>
+#include <Qt3DCore/private/qnodecreatedchangegenerator_p.h>
#include <Qt3DRender/qviewport.h>
+#include <Qt3DRender/private/qviewport_p.h>
#include "testpostmanarbiter.h"
-// We need to call QNode::clone which is protected
-// So we sublcass QNode instead of QObject
-class tst_QViewport: public Qt3DCore::QNode
+class tst_QViewport: public QObject
{
Q_OBJECT
-public:
- ~tst_QViewport()
- {
- QMetaObject::invokeMethod(this, "_q_cleanup", Qt::DirectConnection);
- }
private Q_SLOTS:
@@ -71,15 +66,22 @@ private Q_SLOTS:
QCOMPARE(viewport->normalizedRect(), normalizedRect);
// WHEN
- Qt3DRender::QViewport *clone = static_cast<Qt3DRender::QViewport *>(QNode::clone(viewport));
+ Qt3DCore::QNodeCreatedChangeGenerator creationChangeGenerator(viewport);
+ QVector<Qt3DCore::QNodeCreatedChangeBasePtr> creationChanges = creationChangeGenerator.creationChanges();
// THEN
- QVERIFY(clone != Q_NULLPTR);
- QCOMPARE(viewport->id(), clone->id());
- QCOMPARE(viewport->normalizedRect(), clone->normalizedRect());
+ QCOMPARE(creationChanges.size(), 1);
+
+ const Qt3DCore::QNodeCreatedChangePtr<Qt3DRender::QViewportData> creationChangeData =
+ qSharedPointerCast<Qt3DCore::QNodeCreatedChange<Qt3DRender::QViewportData>>(creationChanges.first());
+ const Qt3DRender::QViewportData &cloneData = creationChangeData->data;
+
+ QCOMPARE(viewport->id(), creationChangeData->subjectId());
+ QCOMPARE(viewport->isEnabled(), creationChangeData->isNodeEnabled());
+ QCOMPARE(viewport->metaObject(), creationChangeData->metaObject());
+ QCOMPARE(viewport->normalizedRect(), cloneData.normalizedRect);
delete viewport;
- delete clone;
}
void checkPropertyUpdates()
@@ -122,13 +124,6 @@ private Q_SLOTS:
QCOMPARE(change->type(), Qt3DCore::NodeUpdated);
}
-
-protected:
- Qt3DCore::QNode *doClone() const Q_DECL_OVERRIDE
- {
- return Q_NULLPTR;
- }
-
};
QTEST_MAIN(tst_QViewport)