[Qt-interest] QGraphicsScene::addItem item has already been added to this scene Error

Sean Harmer sean.harmer at maps-technology.com
Fri Jun 18 12:31:17 CEST 2010


On Friday 18 June 2010 11:00:12 Riccardo Roasio wrote:
> Hi ,
> 
> why this error (QGraphicsScene::addItem item has already been added to
> this scene)  is raised?

Just a wild stab in the dark...could it be because you are adding a 
QGraphicsItem to a scene that already contains that item? ;-)

The usual way this happens is that when you create your QGraphicsItem you 
specify a parent for the item that is already in the scene. In this case there 
is no need to explicitly add it to the scene afterwards as the QGraphicsItem 
constructor does it for you if the parent is already in a scene.

Sean



More information about the Qt-interest-old mailing list