for(int i =0; i <shapes.size(); i++) // shapes is QList<QWidget*> of QShape
{
shapes.at(i)->setShape(QShape::ellipse);
QGraphicsProxyWidget* proxyWid = graphscene->addWidget(shapes.at(i));
}
view->setScene(graphscene);// view is a QGraphicsView object.

I have the above code that i am using to place a number of Qshapes on a Graphics view scene. looking a qt4.8 ressource i found that a QGraphicsProxyWidget need to be created to bridge the scene element with the different QWidget. the code works, but i have a concern wether the implementation is correct, is the proxywid pointer correctly allocated? is it safe to use a pointer this way? i am trying to avoid any memory problem.

Thanks in advance for assisting me