PDA

View Full Version : How to iterate QMap twice



sophister
12th May 2009, 16:09
Hi to all, I have iterated a QMap, but after this, I have to iterate it again, the problem is, I do not know after the first iteration, the iterator is at end of the QMap, or it locaetes itself at the first again automatically??

Thanks in advance!

^NyAw^
12th May 2009, 16:12
Hi,

Simply call "begin()" and get the new iterator that points to the start of the map.

sophister
12th May 2009, 16:50
thanks, but something wrong it seems.

QMapIterator<int, QMap<QString, QToolButton*>* > tabIter(tabs);
and after the first iteration :

tabIter = tabs.begin();

But the compiler find some error

spirit
12th May 2009, 16:59
use this method QMapIterator::toFront if you use java-style iterators.