From 2eb53d735488cd2fb609e51c036c5ee3554557c7 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Tue, 9 May 2017 14:23:24 +0200 Subject: 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 Reviewed-by: Oleg Evseev --- tests/auto/core/qscene/tst_qscene.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto/core/qscene/tst_qscene.cpp') 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 -- cgit v1.2.3