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.
void eMain::load_art() {
pItem
->setPixmap
(QPixmap(strToPixmapPath
));
myScene
->setSceneRect
(0,
0,
QPixmap(strToPixmapPath
).
width(),
QPixmap(strToPixmapPath
).
height());
myScene->addItem(pItem);
}
void eMain::load_art() {
QGraphicsPixmapItem *pItem = new QGraphicsPixamItem();
pItem->setPixmap(QPixmap(strToPixmapPath));
myScene->setSceneRect(0, 0, QPixmap(strToPixmapPath).width(), QPixmap(strToPixmapPath).height());
myScene->addItem(pItem);
}
To copy to clipboard, switch view to plain text mode
That QGraphicsPixmapItem is a memory leak, right? Could i set a parent QGraphicsItem or something?
Thanks and sotty if is a stupid question.
Bookmarks