I drew a grid in qgraphicsscene with QLineF , and you can add custom qgraphicsitems to the scene as blocks in a grid. I want to be able to redraw the grid at different intervals and indexing (indexes are just thicker rows).
My problem is that I do not know how to simply delete the lines. I can remove everything from the scene, but it takes too much work, because I need to copy all my custom elements into an array, and then add them to the scene again. I tried to make a list of pointers in strings, but I cannot delete pointers. I also thought about adding rows as children to qgraphicsitem and deleting that element, which will delete all rows, but you cannot set parents to rows.
How to remove certain line components from qgraphicsscene ?
Like this: scene->removeItem(..pointer..); I incorrectly searched for the result of scene->addItem(..) as an object, and then saved it and the link. When I save the result as a pointer, I was able to manipulate the element again.
source share