Use QDirIterator instead of manually traversing the dir tree.