Reputation: 79
How can i remove QGraphicsPixmapItem
from the scene if it is already added to scene. If not added then add to scene. I have a attached code below.
QGraphicsPixmapItem *linesadd;
previewScene->removeItem(linesadd); //I want to check here whether linesadd item is added or not.
linesadd = new QGraphicsPixmapItem(pixmap);
previewScene->addItem(linesadd);
Upvotes: 1
Views: 69
Reputation: 56
I asume you use QGraphicsScene from your code. If you have a valid pointer to linesadd you have different options.
It this is not what you want, please give some more information on your problem.
Best regards
Upvotes: 1