[Interest] Reasons why deleteLater() might not work

Nikos Chantziaras realnc at gmail.com
Sun Apr 3 10:25:15 CEST 2022


On 01/04/2022 16:17, Michael Jackson wrote:
> I have a bit of code where in I am removing a QWidget from the UI and it needs to be truly cleaned up as its parent QObject is also being cleaned up. I thought I did the appropriate:
> 
> layout->removeWidget(widget);
> widget->setParent(nullptr);
> widget->deleteLater();

Why not simply delete the parent, which will then delete all its 
children immediately?

Also, I don't even remember a single case where I ever needed deleteLater().



More information about the Interest mailing list