QListIterator is a Java-style const iterator, which does not require empty(), instead hasNext() has to be used.
moreover empty() is supposed to be operated on QList, where as hasNext() is supposed to be operated on QListIterator
There may be many ways to iterate the list, here are 3 possible ways
1. Java-style iterators (you already use this, fine)
2. STL-style iterators (slightly faster and more cumbersome to use to than Java-style iterators
QList<AbstractThing *>::const_iterator i;
for (i = this->constBegin(); i != this->constEnd(); ++i)...*i...
QList<AbstractThing *>::const_iterator i;
for (i = this->constBegin(); i != this->constEnd(); ++i)...*i...
To copy to clipboard, switch view to plain text mode
3. Plain index based
for(int i = 0; i < this->size(); i++)...this.at(i)....
for(int i = 0; i < this->size(); i++)...this.at(i)....
To copy to clipboard, switch view to plain text mode
Bookmarks