PDA

View Full Version : QList Pointers



coderbob
20th November 2007, 17:06
In relation to thread http://www.qtcentre.org/forum/f-newbie-4/t-garbabe-collection-10276.html

I have some nested structures that are referenced with a


void passCompletedQList(QList<NestedStrucutre *> *completeReferenceList);


This seems to work best as passing the list as a single pointer to another function for insertion rather then many seperate function calls to append the entries in the main function.

My problem is in the working function I am going to need memory for the QList pointer and doing something like



QList<NestedStrucutre *> *workingReference;

workingReference = new QList(QList<NestedStrucutre *>);

... Create NestedStrutures append them etc ...

passCompletedQList(workingReference);


gives me a "use of class template requires template argument list" error. My lack of formal training has left me with some gaps in logic I just do not understand. Any help would be greatly appreciated.

Bob

jacek
20th November 2007, 18:33
It should be:
workingReference = new QList< NestedStructure * >();or even:
typedef QList< NestedStructure * > NestedStructureList;
...
workingReference = new NestedStructureList();

coderbob
20th November 2007, 18:50
Thank you, hopefully there will be some questions I can contribute on and give back.

Bob