什么版本的Qt?下面是4.3中exists函数:
bool QFile::exists () const
This is an overloaded member function, provided for convenience.
Returns true if the file specified by fileName() exists; otherwise returns false.
内容被清空可能是文件的内容被改变了,可能是if(!QFile::existe(f))里面的东西被执行了吧。
不妨多加几处qDebug()看看。