PDA

View Full Version : How to remove a QGraphicsPixmapItem from a Scene?



vitaR
8th April 2014, 22:50
Hi, I need to remove some images in the QgraphicsScene, but I don't know how, cause the function remove that is originally a function of QGraphicsItem, don't appear. My code here:



QTransform transform;
int x = recorGato->col*40+220;
int y = recorGato->row*40+120;
QGraphicsPixmapItem *image2 = qgraphicsitem_cast<QGraphicsPixmapItem*>(scene->itemAt(x,y,transform));
image2->setPos(10.0,10.0); //Need to replace move position for remove item here.


Where the only thing I could do to not see this image, is move it to another position (last line of the code I showed).
Thanks for your time.

ChrisW67
9th April 2014, 00:16
Is there something wrong with QGraphicsScene::removeItem()?

QGraphicsItem has no function called remove().

vitaR
9th April 2014, 02:03
Is there something wrong with QGraphicsScene::removeItem()?

QGraphicsItem has no function called remove().

Thanks, maybe I was confuse about it, maybe I thought removeItem() was a function of QGraphicsItem.