[Qt-interest] remove QgRaphicsItem from parent

Rainer Wiesenfarth Rainer.Wiesenfarth at inpho.de
Thu Oct 8 16:07:43 CEST 2009


(please reply to the list rather than to me personal. And avoid top-posting)

From: Riccardo Roasio [mailto:riccardo.roasio at gmail.com] 
> 
> 2009/10/8 Rainer Wiesenfarth <Rainer.Wiesenfarth at inpho.de>:
> >
> > From: qt-interest-bounces at trolltech.com
> >> i have a class that inherit QGraphicsItem.
> >>
> >> How can i remove it if i want to destropy it and make it no
> >> more visible?
> >
> > By simply delete'ing it? See the 
> QGraphicsItem::~QGraphicsItem() doc:
> >
> >  QGraphicsItem::~QGraphicsItem ()   [virtual]
>
> Yes but its virtual..so i need to reimplement it by myself...
> 
> What i have to do to remove item from parent?

A virtual _destructor_ is always called, even if a derived class has an own
destructor (which will be a different method, not only by name). The keyword
'virtual' when used with destructors simply asserts that any derived class'
destructor is called first.

So you do not have to take care about re-implementing ~QGraphicsItem()
functionality.

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
INPHO GmbH * Smaragdweg 1 * 70174 Stuttgart * Germany
phone: +49 711 2288 10 * fax: +49 711 2288 111 * web: www.inpho.de
place of business: Stuttgart * managing director: Johannes Saile
commercial register: Stuttgart, HRB 9586
Leader in Photogrammetry and Digital Surface Modelling
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3438 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091008/b0aa0536/attachment.bin 


More information about the Qt-interest-old mailing list