I\'m new to Qt and trying to learn the idioms.
The foreach documentation says:
Qt automatically takes a copy of the container when it enters a
You should better use iterators for that:
// Remove all odd numbers from a QList QMutableListIterator i(list); while (i.hasNext()) { if (i.next() % 2 != 0) i.remove(); }