Results 1 to 7 of 7

Thread: QList of Qlists?

  1. #1
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QList of Qlists?

    I would like to create a QList of QLists, but seem to be having trouble. So I figured I would make sure I can do what I am attempting before spending too much time.

    My question is, can I make a QList of QLists? If so, what is the proper declaration?


    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QList of Qlists?

    Yes, you can:
    Qt Code:
    1. QList< QList<int> > list;
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. #3
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QList of Qlists?

    Quote Originally Posted by jpn View Post
    Yes, you can:
    Qt Code:
    1. QList< QList<int> > list;
    To copy to clipboard, switch view to plain text mode 
    OK. I tried that, but I am getting errors. At least now I know it is possible and I am doing something else wrong.


    Thanks for the sanity check!

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QList of Qlists?

    Note the space between the two ">"
    Qt Code:
    1. QList<QList<int>> // syntax error!
    To copy to clipboard, switch view to plain text mode 
    Perhaps you find it easier if you introduce a typedef.

    Qt Code:
    1. typedef QList<MyType> MyList;
    2. QList<MyList> aListOfLists;
    To copy to clipboard, switch view to plain text mode 

  5. #5
    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 of Qlists?

    Quote Originally Posted by markcole View Post
    I tried that, but I am getting errors.
    Could you post the first error message?

  6. #6
    Join Date
    Apr 2007
    Posts
    23
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QList of Qlists?

    Sorry, I have been away.

    Probably a space issue, since it worked when I tried it again. I can try and recreate it if you would like.

    Thanks all.

  7. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QList of Qlists?

    Yes its a space issue
    QList<QList<int>> // syntax error!
    As far as I remember >> cause problem in parsing. give a space between them > > and it will work.

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 or QLinkedList
    By eleanor in forum Newbie
    Replies: 6
    Last Post: 9th November 2007, 09:40
  3. Q3Ptrlist v/s QList
    By joseph in forum Qt Programming
    Replies: 3
    Last Post: 25th September 2007, 11:27
  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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.