Tracing: Don't rebuild flame graph if there is nothing to see

If the root size is 0, none of the nodes will be visible. Don't create
them in the first place.

Task-number: QTCREATORBUG-20772
Change-Id: I9595daece2d17fe8202b322ffafd361d6fa422fa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Ulf Hermann
2018-07-12 14:27:26 +02:00
parent 3a4592609c
commit d7733bafe1

View File

@@ -185,12 +185,14 @@ void FlameGraph::rebuild()
return;
}
if (m_model->data(m_root, m_sizeRole).toReal() > 0) {
if (m_root.isValid()) {
QObject *parentObject = appendChild(this, this, qmlContext(this), m_root, 0, 1);
m_depth = buildNode(m_root, parentObject, 1, m_maximumDepth);
} else {
m_depth = buildNode(m_root, this, 0, m_maximumDepth);
}
}
emit depthChanged(m_depth);
}