如果已将QGraphicsPixmapItem
已添加到场景中,如何将其删除。如果未添加,则添加到场景。我在下面附有代码。
QGraphicsPixmapItem *linesadd;
previewScene->removeItem(linesadd); //I want to check here whether linesadd item is added or not.
linesadd = new QGraphicsPixmapItem(pixmap);
previewScene->addItem(linesadd);
最佳答案
我假设您从代码中使用QGraphicsScene。
如果您有指向linesadd的有效指针,则可以使用其他选项。
这不是您想要的,请提供有关您的问题的更多信息。
最好的祝福
关于c++ - 如果QGraphicsPixmapItem已添加到场景中,则将其删除。如果不添加到场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45473937/