PDA

View Full Version : delete



mickey
13th July 2006, 13:04
Hi, Do I have to call 'delete' in anywhere? (eg. destructor)? thanks. Or Does qt provide it to itself? Does it do this for every widgets?


std::vector <FancyPopup*> ppop; //member of Mainform class
//inside constructor of Mainform class
for (int i=0; i<8; i++)
ppop.push_back(new FancyPopup(this));

jacek
13th July 2006, 13:13
You don't have to (but you can). Every QObject (i.e. widget too) which has a parent will be deleted when its parent is destroyed.

In this case all FancyPopup instances will be deleted when you destroy Mainform (note that this also means that they won't be deleted if you won't destroy Mainform).