diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2017-05-09 14:23:24 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-05-10 04:12:45 +0000 |
commit | 2eb53d735488cd2fb609e51c036c5ee3554557c7 (patch) | |
tree | b7c654fe29267515425e0830ada1174ea3dfea5e /tests/auto/core/qscene/tst_qscene.cpp | |
parent | c0f12806a2851f481788f383fef569d441b131ed (diff) |
QNode: setParent create creation change only when needed
Two cases need to be handled by setParent:
1) Parent already has a backend node and receives a new child
-> in which case we need to send the creation event to the backend
2) Parent was created in the frontend, but has no backend (delayed
notification sending because a ctor can't call a virtual)
-> in that case, when adding a child and setting its parent we shouldn't be
sending the creation change. We rather let that be handled when the
creation change for the parent is requested
Change-Id: I434c7d4e6af785c0314ac6538dc689992d90ed0c
Task-number: QTBUG-60612
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Oleg Evseev <ev.mipt@gmail.com>
Diffstat (limited to 'tests/auto/core/qscene/tst_qscene.cpp')
-rw-r--r-- | tests/auto/core/qscene/tst_qscene.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/core/qscene/tst_qscene.cpp b/tests/auto/core/qscene/tst_qscene.cpp index f4b04362d..78f17e8fa 100644 --- a/tests/auto/core/qscene/tst_qscene.cpp +++ b/tests/auto/core/qscene/tst_qscene.cpp @@ -297,6 +297,8 @@ void tst_QScene::deleteChildNode() Qt3DCore::QNode *root2 = new tst_Node(); Qt3DCore::QNodePrivate::get(root1)->setScene(scene); Qt3DCore::QNodePrivate::get(root2)->setScene(scene); + Qt3DCore::QNodePrivate::get(root1)->m_hasBackendNode = true; + Qt3DCore::QNodePrivate::get(root2)->m_hasBackendNode = true; // WHEN scene->addObservable(root1); @@ -358,6 +360,7 @@ void tst_QScene::removeChildNode() Qt3DCore::QNode *root = new tst_Node; Qt3DCore::QNodePrivate::get(root)->setScene(scene); + Qt3DCore::QNodePrivate::get(root)->m_hasBackendNode = true; scene->addObservable(root); // WHEN |