PDA

View Full Version : QList of Qlists?



markcole
1st July 2008, 19:59
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

jpn
1st July 2008, 20:00
Yes, you can:

QList< QList<int> > list;

markcole
1st July 2008, 20:06
Yes, you can:

QList< QList<int> > list;

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!

caduel
1st July 2008, 20:55
Note the space between the two ">"

QList<QList<int>> // syntax error!
Perhaps you find it easier if you introduce a typedef.


typedef QList<MyType> MyList;
QList<MyList> aListOfLists;

jacek
2nd July 2008, 02:09
I tried that, but I am getting errors.
Could you post the first error message?

markcole
7th July 2008, 20:04
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.

aamer4yu
8th July 2008, 05:44
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.