Deleting QGraphicsItem very slow
-
I am having problems deleting large numbers of QGraphicsItems. In one case, it takes about 30 seconds to create 100,000 QGraphicsItems put into 11 QGraphicsItemGroups, but it takes about 90 seconds to delete all these items. That is a long time for the user to wait unloading one document to then load a new one. Has anyone else noticed slowness deleting QGraphicsItems? Has anyone found a way around it?
Looking at the QGraphicsItem code, it might just be that all the checking in the destructor takes a longer time than setting up a simple QGraphicsItem. The solution I am contemplating is to delete all these items in a background thread.