Hi guys,
I'm sort of confused right now. Let's say I have created a QGraphicsLineItem(), which will eventually have children (all sorts of graphics items, doesn't really matter). Now I want to explicitly delete my object:
Qt Code:
//... //... delete line; line = 0;To copy to clipboard, switch view to plain text mode
Now the part I don't get is that in the Qt sources the destructor of QGraphicsLineItem is empty:
Qt Code:
{ }To copy to clipboard, switch view to plain text mode
QGraphicsLineItem is, of course, a sub-class of QGraphicsItem, which has the destructor defined with code to delete all its children.
So, how is it, that if I delete my QGraphicsLineItem that it will also delete all its children (i.e. *label)? The base class destructor QGraphicsItem::~QGraphicsItem() is declared as virtual, thus a destructor wouldn't be needed for QGraphicsLineItem, right? And by declaring an own destructor for QGraphicsLineItem which is empty, the base class destructor doesn't get called, right?
Or am I missing something here?
Thanks.
Bookmarks