Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QList and delete

I have a QList with pointers to objects with class type Model. I would like to delete appropriately this QList after it has being used. I know Qt philosophy is to avoid C-style memory management. How do I delete this QList?

like image 566
kiriloff Avatar asked Jul 19 '12 07:07

kiriloff


People also ask

What is QList in Qt?

QList<T> is one of Qt's generic container classes. It stores items in a list that provides fast index-based access and index-based insertions and removals.


1 Answers

You could use qDeleteAll:

qDeleteAll(lstMdls);

lstMdls.clear();
like image 159
sgibb Avatar answered Oct 17 '22 20:10

sgibb