Use QDir::cdUp() to simplify code.