[ui][graph] do layout reset for graphs without NodesPositions Feature

allow to set initial position for older projects or new projects that have not been saved yet
This commit is contained in:
Yann Lanthony 2018-07-26 22:39:03 +02:00
parent f415745a4a
commit 2bd06c4edb

View file

@ -211,6 +211,10 @@ class UIGraph(QObject):
self._graph = g
self._graph.updated.connect(self.onGraphUpdated)
self._graph.update()
# perform auto-layout if graph does not provide nodes positions
if Graph.IO.Features.NodesPositions not in self._graph.fileFeatures:
self._layout.reset()
self._undoStack.clear() # clear undo-stack after layout
self.graphChanged.emit()
def onGraphUpdated(self):