PDA

View Full Version : QMap in QList ?



npc
5th February 2007, 11:19
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 ?

jpn
5th February 2007, 11:50
Yes, it's possible:


QMap<Key, Type> map;
QList< QMap<Key, Type> > list;
list.append(map);

// or
typedef QMap<Key, Type> MyMap;
MyMap map;
QList<MyMap> list;
list.append(map);

sarode
5th February 2007, 11:51
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