Proc Proc - 4 months ago 23
C++ Question

Unable to read contents of QGraphicsScene

I'm having some issues with Qt with c++ and reading the contents of my scene, here is my current code:

foreach(QGraphicsItem* item, ui->graphicsView->scene()->items())
qDebug() << item->x();

Currently this code is able to set all the items in my scene to invisible which is great however the query for all the item coordinates returns a 0 for every item in the scene. I feel I have some stupid mistake with pointers but I'm lost here currently.

Thanks in advance.

Answer Source

if a item is invisible it will not be possible to query for coordinates, for all effects it's just like if it was removed from the scene.