View Full Version : How to iterate QMap twice

12th May 2009, 17: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!

12th May 2009, 17:12

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

12th May 2009, 17: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

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