[ui] Graph: change setGraph and clear

This commit is contained in:
Julien-Haudegond 2020-08-17 11:45:17 +02:00
parent 8020cf5158
commit b9e68b7c3e

View file

@ -275,7 +275,11 @@ class UIGraph(QObject):
if self._graph:
self.stopExecution()
self.clear()
oldGraph = self._graph
self._graph = g
if oldGraph:
oldGraph.deleteLater()
self._graph.updated.connect(self.onGraphUpdated)
self._graph.update()
# perform auto-layout if graph does not provide nodes positions
@ -320,8 +324,7 @@ class UIGraph(QObject):
if self._graph:
self.clearNodeHover()
self.clearNodeSelection()
self._graph.deleteLater()
self._graph = None
self._graph.clear()
self._sortedDFSChunks.clear()
self._undoStack.clear()