A c++ newbie question about memory leak ( QGraphicsPixmapItem )
Hi.
I'm newbie on programming and have a doubt about the memory leaks.
I have a QGraphicsScene with a parent, this is ok, it will be erased when the app closes or the parent is distroyed, but i want to add QGraphicsPixmapItem.
Code:
void eMain::load_art() {
pItem
->setPixmap
(QPixmap(strToPixmapPath
));
myScene
->setSceneRect
(0,
0,
QPixmap(strToPixmapPath
).
width(),
QPixmap(strToPixmapPath
).
height());
myScene->addItem(pItem);
}
That QGraphicsPixmapItem is a memory leak, right? Could i set a parent QGraphicsItem or something?
Thanks and sotty if is a stupid question.
Re: A c++ newbie question about memory leak ( QGraphicsPixmapItem )
QGraphicsScene::addItem():
Quote:
Adds or moves the item and all its childen to this scene. This scene takes ownership of the item.