For that reason, iterators are rarely useful in connection with QList. One place where STL-style iterators do make sense is as arguments to generic
doc.trolltech.com/4.2/qlist-iterator.html


So if I have a for loop, where the macro foreach isn't an option. Should I use iterators or indexes?


Qt Code:
  1. for(int i = 0; i < list.size(); i++) {
  2. Do something with list[i]
  3. blah blah blah
  4. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. for(QList<type>::iterator i = list.begin(); i != list.end(); ++i) {
  2. Do something with *i
  3. blah blah blah
  4. }
To copy to clipboard, switch view to plain text mode