Results 1 to 3 of 3

Thread: QList inside a QList

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2008
    Posts
    25
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 5 Times in 5 Posts

    Default Re: QList inside a QList

    Hi jano_alex_es!

    It is possible, the only problem is that QList::at returns a const reference to the item, use the [] operator instead. Of course, a new list should be added to my_list first.


    Qt Code:
    1. QList<QList<QPointF> > my_list;
    2. QList<QPointF> my_subList;
    3. QPointF my_point(0, 10);
    4. my_list.append(my_subList);
    5. my_list[0].append(my_point);
    To copy to clipboard, switch view to plain text mode 

    It's not the best example, because my_point could be added to my_subList, and then my_subList to my_list.
    Last edited by gsmiko; 1st July 2009 at 12:20.

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. QList, copy problems
    By Valheru in forum Qt Programming
    Replies: 4
    Last Post: 5th February 2010, 00:06
  3. Destroying a QList the right way
    By Cruz in forum Newbie
    Replies: 1
    Last Post: 19th January 2009, 10:52
  4. QList
    By dragon in forum Qt Programming
    Replies: 11
    Last Post: 9th May 2007, 20:15
  5. Accessing QList Objects
    By magikalpnoi in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2006, 20:43

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
  •  
Qt is a trademark of The Qt Company.