QValueList, how to remove and free allocated memory
Hi,
I have a class that has a member of type
Code:
QValueList<AClassOfMine*> list
and a function
Code:
void addClass(AClassOfMine value)
This function do only the two following lines of code
Code:
AClassOfMine* myClass = new AClassOfMine(value);
list.append(myClass);
How can I remove and free all elements in my list ?
For the moment I just do
but I expect some memory leaks to soon come.
So, how can I solve my problem ?
Thanks in advance
Re: QValueList, how to remove and free allocated memory
Use QPtrList instead of QValueList and set AutoDelete to true.
Re: QValueList, how to remove and free allocated memory
In Qt3 you can use QPtrList with setAutoDelete( true ).