diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2014-10-15 11:20:02 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-10-15 19:37:49 +0200 |
commit | 0f1d0ff5b3adb16afcda091e4ff4657f53581f79 (patch) | |
tree | bc82ff1bd2f31fe5fa54590ab3f1500d716b07eb /tests | |
parent | a4b9ce44ae244104a941981405742ee42d53ebe0 (diff) |
Hide doClone implementations behind a macro
This way we will avoid inconsistencies. It also means making some of the
copy() implementations more clever.
Change-Id: Ic79c9ec7c9c32f8951d5d9f5184592880bf8d5fd
Reviewed-by: James Turner <james.turner@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/core/nodes/tst_nodes.cpp | 12 | ||||
-rw-r--r-- | tests/auto/core/qscene/tst_qscene.cpp | 14 |
2 files changed, 4 insertions, 22 deletions
diff --git a/tests/auto/core/nodes/tst_nodes.cpp b/tests/auto/core/nodes/tst_nodes.cpp index 7e379aac6..c59a11304 100644 --- a/tests/auto/core/nodes/tst_nodes.cpp +++ b/tests/auto/core/nodes/tst_nodes.cpp @@ -77,12 +77,7 @@ public: QString customProperty() const { return m_customProperty; } protected: - Qt3D::QNode *doClone() const Q_DECL_OVERRIDE - { - MyQNode *clone = new MyQNode(); - clone->copy(this); - return clone; - } + QT3D_CLONEABLE(MyQNode) QString m_customProperty; @@ -97,10 +92,7 @@ public: // QNode interface protected: - Qt3D::QNode *doClone() const Q_DECL_OVERRIDE - { - return new MyQComponent(); - } + QT3D_CLONEABLE(MyQComponent) }; diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp index 7c39236b7..dc287798f 100644 --- a/tests/auto/core/qscene/tst_qscene.cpp +++ b/tests/auto/core/qscene/tst_qscene.cpp @@ -94,12 +94,7 @@ public: tst_Node() : Qt3D::QNode() {} protected: - Qt3D::QNode *doClone() const Q_DECL_OVERRIDE - { - tst_Node *clone = new tst_Node(); - clone->copy(this); - return clone; - } + QT3D_CLONEABLE(tst_Node) }; class tst_Component : public Qt3D::QComponent @@ -108,12 +103,7 @@ public: tst_Component() : Qt3D::QComponent() {} protected: - Qt3D::QNode *doClone() const - { - tst_Component *clone = new tst_Component; - clone->copy(this); - return clone; - } + QT3D_CLONEABLE(tst_Component) }; void tst_QScene::addObservable() |