Another suggestion is to avoid the classic C counter construct and at() or []. Use foreach (QString s, temp) { ... } Faster, less error prone, easier to parallelize later on.