S
S
Sencis2019-03-28 12:38:07
Qt
Sencis, 2019-03-28 12:38:07

How to remove multiple QGraphicsObject from a scene?

How to remove multiple QGraphicsObject objects from the scene without using the mouse how to select them all?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Sorokin, 2019-03-28
@Userpc0101

Well, something like

auto items = scene->items();
for (auto item : items) {
   if (item <имеет что-то, что говорит нам о том что ее нужно удалить>)
      scene->removeItem(item);
}

S
Sencis, 2019-03-28
@Userpc0101

ATP, I did it a little differently, but the answer helped

foreach(MapGraphicsObject * obj, _objects)
      this->removeObject(obj);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question