[Qt-interest] remove QgRaphicsItem from parent

Riccardo Roasio riccardo.roasio at gmail.com
Thu Oct 8 16:11:52 CEST 2009


But it seems not to work..

i use this code:

  for(int i=0;i<elements.size();i++)
      {
        ReceiptElement *e=elements.at(i);
        e->~QGraphicsItem();
      }

and i think this will remove all elements from screen but they
continue to be displayed....

Also calling an update on the parent item after these actions doesen't
solve the issue

What i'm doing wrong?

Thanks,
Riccardo

2009/10/8 Rainer Wiesenfarth <Rainer.Wiesenfarth at inpho.de>:
>
> (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
>




More information about the Qt-interest-old mailing list