diff --git a/CHANGELOG.md b/CHANGELOG.md index b3875a711f9..bd8da86d07f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. * added backward compatibility for view management * bugfixes * fixed incompatibility between shipped zlib and QuaZip libraries + * fixed layout bug which occured when leftmost node had no inputs ## [4.3.0](v4.3.0) - 2024-07-02 13:42:55+02:00 (urgency: medium) * **WARNING:** this release breaks compatibility with Ubuntu 20.04 LTS diff --git a/plugins/gui/src/graph_widget/contexts/graph_context.cpp b/plugins/gui/src/graph_widget/contexts/graph_context.cpp index 4b9a7866b8c..552e72c8664 100644 --- a/plugins/gui/src/graph_widget/contexts/graph_context.cpp +++ b/plugins/gui/src/graph_widget/contexts/graph_context.cpp @@ -786,6 +786,12 @@ namespace hal } } + if (nodesToPlace.isEmpty()) + { + log_warning("gui", "Cannot restore view id={}, there are no nodes to place.", mId); + return false; + } + mModules.clear(); mGates.clear(); for (const QPair& box : nodesToPlace) diff --git a/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp b/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp index d3493a7fc83..0d56740554c 100644 --- a/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp +++ b/plugins/gui/src/graph_widget/layouters/graph_layouter.cpp @@ -669,6 +669,12 @@ namespace hal mCoordY[pnt.y()].testMinMax(rect.bottom()); } + // add topmost and leftmost coordinate entry (unless it already exists) + if (!mCoordX.contains(mNodeBoundingBox.left())) + mCoordX[mNodeBoundingBox.left()].testMinMax(0); + if (!mCoordY.contains(mNodeBoundingBox.top())) + mCoordY[mNodeBoundingBox.top()].testMinMax(0); + // fill gaps in coordinate system if any if (!mCoordX.isEmpty()) {