Commit ccef3793 authored by Valentin Valls's avatar Valentin Valls

Add transaction when removing many items

parent cc29a6a5
...@@ -155,11 +155,12 @@ class Plot(qt.QObject): ...@@ -155,11 +155,12 @@ class Plot(qt.QObject):
def removeItem(self, item: Item): def removeItem(self, item: Item):
items = self.__itemTree(item) items = self.__itemTree(item)
for i in items: with self.transaction():
item._setPlot(None) for i in items:
self.__items.remove(i) item._setPlot(None)
for i in items: self.__items.remove(i)
self.itemRemoved.emit(i) for i in items:
self.itemRemoved.emit(i)
self.invalidateStructure() self.invalidateStructure()
def items(self) -> List[Item]: def items(self) -> List[Item]:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment