How to actually remove a QGraphicsItem from the screen?
-
12-06-2021 - |
Question
I've got a QGraphicsItem (a map) that has some children (icons on that map). No issues so far.
However, I want to be able to remove the icons from the screen. In order to do this, I tried to just break up the parent-children relationship:
foreach(QGraphicsItem* item, displayedIcons) {
item->setParentItem(NULL);
}
In some way, the map and the icons are detached from each other, i.e. when I pan the map, the icons remain at their absolute position on the screen. But the problem is, that the icons are still displayed at all.
Is there anything I am missing in order to actually remove the icons from the screen?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow