summaryrefslogtreecommitdiffstats
path: root/src/core/nodes
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2020-03-19 17:32:25 +0000
committerMike Krus <mike.krus@kdab.com>2020-03-20 06:09:17 +0000
commite819e8d654fb8d15d24961d56578025c6171610c (patch)
tree788a093ce233ca02a5e4a934fdd12c315d1a70b1 /src/core/nodes
parenta6ffce09ce6d4fd39fbb50eb58f7b5d1027f4d60 (diff)
Fix scene graph dump
Might have QNodes "between" parents and child entities. Change-Id: Ie041508ec96c39b779bc75a6ad4d38c604e322e2 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/core/nodes')
-rw-r--r--src/core/nodes/qentity.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/nodes/qentity.cpp b/src/core/nodes/qentity.cpp
index 1199dfc4b..7d64d4e70 100644
--- a/src/core/nodes/qentity.cpp
+++ b/src/core/nodes/qentity.cpp
@@ -79,18 +79,19 @@ QString dumpNode(const Qt3DCore::QEntity *n) {
return res;
}
-QStringList dumpSG(const Qt3DCore::QEntity *n, int level = 0)
+QStringList dumpSG(const Qt3DCore::QNode *n, int level = 0)
{
QStringList reply;
- QString res = dumpNode(n);
- reply += res.rightJustified(res.length() + level * 2, ' ');
+ const auto *entity = qobject_cast<const Qt3DCore::QEntity *>(n);
+ if (entity != nullptr) {
+ QString res = dumpNode(entity);
+ reply += res.rightJustified(res.length() + level * 2, ' ');
+ level++;
+ }
const auto children = n->childNodes();
- for (auto *child: children) {
- auto *childFGNode = qobject_cast<Qt3DCore::QEntity *>(child);
- if (childFGNode != nullptr)
- reply += dumpSG(childFGNode, level + 1);
- }
+ for (auto *child: children)
+ reply += dumpSG(child, level);
return reply;
}