Drop the foreach and use a for with an index (or an iterator)

Qt Code:
  1. for(int i = 0; i < nickList.count(); ++i) {
  2. if(nicklist.at(i).name == "fons") {
  3. nickList.removeAt(i);
  4. break;
  5. }
  6. }
To copy to clipboard, switch view to plain text mode