Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
auto-delete of QGraphicsItems


Message 1 in thread

Hi,

does anyone know who is responsible for deleting a QGraphicsItem? I
cannot set the QGraphicsScene as parent.

Will the scene delete its items if it gets deleted or do I have to call
delete in the destructor?

Greetings
Jens

--
 [ signature omitted ] 

Message 2 in thread

Hmmm...
QGraphicsScene has the handles of all QGraphicsItems that are added to
the scene.
Hence I think, the items destructor should be called by the scene when
scene is destroyed.

Of course you would need to free up any memory that you may have
allocated from within the item in the 
items destructor...

Cheers!
Prateek

-----Original Message-----
From: Jens [mailto:jens-devel@xxxxxx] 
Sent: Friday, August 10, 2007 3:25 PM
To: qt
Subject: auto-delete of QGraphicsItems

Hi,

does anyone know who is responsible for deleting a QGraphicsItem? I
cannot set the QGraphicsScene as parent.

Will the scene delete its items if it gets deleted or do I have to call
delete in the destructor?

Greetings
Jens

--
 [ signature omitted ]