[Qt-interest] QTextEdit not deleted when implemented as list

ross at earz.ca ross at earz.ca
Thu Jun 23 16:53:30 CEST 2011


I need to start rereading my code three times instead of twice...

> I would suggest that you call hide() on the text edits and then call
> deleteLater() if you want to clean up the memory early.  Perhaps your loop
> should look more like this:
>
>
> for(int i=0; i<cnt; i++)
> {
>     QTextEdit p = list.at(i);
>     p->hide();
>     p->deleteLater();
> }
>

Of course that should read:

for(int i=0; i<cnt; i++)
{
    QTextEdit* p = list.at(i);
    p->hide();
    p->deleteLater();
}

Time for another coffee.

R.






More information about the Qt-interest-old mailing list