Results 1 to 3 of 3

Thread: QMap in QList ?

  1. #1
    Join Date
    Mar 2006
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Smile QMap in QList ?

    Hi,

    I am having list of maps, want to store these maps in somewhere and access through iterator or something like that. how can we use this ?


    Is it possible to creat a list (QList) of QMaps ? if NO, why ?

  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: QMap in QList ?

    Yes, it's possible:
    Qt Code:
    1. QMap<Key, Type> map;
    2. QList< QMap<Key, Type> > list;
    3. list.append(map);
    4.  
    5. // or
    6. typedef QMap<Key, Type> MyMap;
    7. MyMap map;
    8. QList<MyMap> list;
    9. list.append(map);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    frankiefrank (6th January 2011)

  4. #3
    Join Date
    May 2006
    Posts
    32
    Thanks
    1
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QMap in QList ?

    Hi...

    I think you can use QList fo this .... here is code snap.
    You can find an example in Qt assistant of Qt 4.1.0 search for QMap.

    cheers

Similar Threads

  1. QList crash in destructor
    By mclark in forum Newbie
    Replies: 7
    Last Post: 6th December 2006, 15:27
  2. Accessing QList Objects
    By magikalpnoi in forum Qt Programming
    Replies: 7
    Last Post: 21st September 2006, 20:43
  3. QMap Problem with arguments.
    By ankurjain in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2006, 12:12
  4. Values not being appended in a QList
    By Kapil in forum Newbie
    Replies: 5
    Last Post: 21st April 2006, 10:20
  5. QMap destructor bug
    By Ruud in forum Qt Programming
    Replies: 6
    Last Post: 8th April 2006, 09:08

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.