Results 1 to 4 of 4

Thread: dynamic array of QStringList and QList

  1. #1
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Question dynamic array of QStringList and QList

    I could use some help with declaring QStringList and QList dynamically:

    During runtime I need to declare N QStringLists and QLists with length L. Would someone be able to help with an example of how to do this.

    Thank you so much!!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: dynamic array of QStringList and QList

    You mean a list of list?

    Cheers,
    _

  3. #3
    Join Date
    Aug 2009
    Posts
    122
    Thanks
    74
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: dynamic array of QStringList and QList

    Hi,

    Yes, I mean a list of lists.
    Example:

    1: andy, mary, joe
    2: james, george, john, jim
    3: jeremy, jane

    Thanks!

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: dynamic array of QStringList and QList

    Qt Code:
    1. QList<QStringList> list;
    2. // or if L is known and likely to be reasonably fixed
    3. const int L = 10;
    4. QVector<QStringList> list(L);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. using QStringList as QList<QListWidgetItem*>
    By geleven in forum Qt Programming
    Replies: 3
    Last Post: 8th April 2010, 18:13
  2. QStringList or QList , which is faster
    By BalaQT in forum Newbie
    Replies: 3
    Last Post: 3rd April 2010, 08:48
  3. QList/QStringList comparison question
    By di_zou in forum Newbie
    Replies: 5
    Last Post: 28th October 2009, 14:35
  4. qstringlist array crashes program
    By chrisb123 in forum Newbie
    Replies: 4
    Last Post: 23rd October 2009, 15:03
  5. Casting QStringList to QList<QVariant>
    By Valheru in forum Newbie
    Replies: 3
    Last Post: 5th October 2006, 22:24

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.