QList<int*> name; name is a QList which contains pointers to int (note that no objects are created now).
If you use it make sure you initialize the pointers, else you will get "seg fault" or "access violation"
And if you allocate memory on the heap, you will need to delete those pointers (the list doesn't do that automatically***)
***for the types that can have parents and have a parent you don't need that since Qt has some memory management for QObjects see parent-child relationship in the documentation.
Added after 37 minutes:
Yes you can, it's the same as: int *name; //it's a matter of style if you put the '*' closer to the type, or closer to the pointer variable name, the compiler doesn't care.





Reply With Quote

Bookmarks