fix build with Qt4.8 on Windows with MSVC. for some reason we can't
iterate QVectors using a foreach loop; instead we use a good old for loop.