Re-check the if-clause. QFile::open() returns true if successful; otherwise returns false.