View Full Version : how to kill parent widget?
mahe2310
23rd March 2006, 06:37
My application calls another widget from the current and i never need the previous widget.
So i want to kill the parent widget to avoid memory leak.
I want to solve this problem as my widgets chains a lot.
Can anybody help?
Mahe2310
zlatko
23rd March 2006, 09:08
delete pWidget;
mahe2310
23rd March 2006, 09:39
delete pWidget;
If i am reusing it again. then ? :(
pWidget name should be a global variable.. Right???
that means all the widgets should be global...
But if we are declaring these widget together in a header file and calls the header file by each of the file,
then redeclaration error is generated.
If i declare them static in the headers then once we delete it will not be created again.
Mahe2310
jacek
23rd March 2006, 12:56
Try setting Qt::WA_DeleteOnClose attribute or invoking QObject::deleteLater(), but make sure that "parent" widget is not a parent of other windows, because it will delete them also. Another alternative is to turn your windows into singletons and just hide them when you don't need them.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.