[GraphEditor] Return empty bbox if the graph is empty

This commit checks whether there is a node in the graph before trying
to determine the size and position of the bounding box. If the graph is
empty, an bounding box set with 0s is returned.
This commit is contained in:
Candice Bentéjac 2024-08-09 16:03:28 +02:00 committed by Aurore LAFAURIE
parent c428015bdc
commit da2c3fda05

View file

@ -1019,6 +1019,9 @@ Item {
function boundingBox() {
var first = nodeRepeater.itemAt(0)
if (first === null) {
return Qt.rect(0, 0, 0, 0)
}
var bbox = Qt.rect(first.x, first.y, first.x + first.width, first.y + first.height)
for (var i = 0; i < root.graph.nodes.count; ++i) {
var item = nodeRepeater.itemAt(i)