PDA

View Full Version : Removing child item from QGRaphicsItem



mangeshj
17th January 2011, 13:23
Hi,
I have added few QGraphicsItems to a parent QGraphicsItem.Then I need to remove some child items from the parent QGraphicsItem. But there seems to be no function to remove child QGraphicsItems. QGraphicsScene provides functions(addItem and removeItem). Is there any way to remove child QGraphicsItems from the parent QGraphicsItem.

Thanks,
Mangesh

stampede
17th January 2011, 13:28
Try

childToRemove->setParentItem(NULL);

This will also add the "childToRemove" object to the parent's scene, if you want you must remove it from this scene yourself.