Results 1 to 3 of 3

Thread: QList Pointers

  1. #1
    Join Date
    Oct 2007
    Posts
    78
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QList Pointers

    In relation to thread http://www.qtcentre.org/forum/f-newb...ion-10276.html

    I have some nested structures that are referenced with a
    Qt Code:
    1. void passCompletedQList(QList<NestedStrucutre *> *completeReferenceList);
    To copy to clipboard, switch view to plain text mode 

    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

    Qt Code:
    1. QList<NestedStrucutre *> *workingReference;
    2.  
    3. workingReference = new QList(QList<NestedStrucutre *>);
    4.  
    5. ... Create NestedStrutures append them etc ...
    6.  
    7. passCompletedQList(workingReference);
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QList Pointers

    It should be:
    Qt Code:
    1. workingReference = new QList< NestedStructure * >();
    To copy to clipboard, switch view to plain text mode 
    or even:
    Qt Code:
    1. typedef QList< NestedStructure * > NestedStructureList;
    2. ...
    3. workingReference = new NestedStructureList();
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Oct 2007
    Posts
    78
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QList Pointers

    Thank you, hopefully there will be some questions I can contribute on and give back.

    Bob

Similar Threads

  1. Sorting using qSort(), - if QList contains POINTERS
    By joseph in forum Qt Programming
    Replies: 13
    Last Post: 18th August 2013, 18:55
  2. Q3Ptrlist v/s QList
    By joseph in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2007, 11:27
  3. QList
    By dragon in forum Qt Programming
    Replies: 11
    Last Post: 9th May 2007, 20:15
  4. Accessing QList Objects
    By magikalpnoi in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2006, 20:43
  5. QList of pointers
    By Farcaller in forum Newbie
    Replies: 4
    Last Post: 24th January 2006, 16:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.