我也遇到这个诡异的问题
file = new QFile(".\\history\\ss.txt");
fileName = file->fileName();
if(!file->open(QIODevice::ReadOnly | QIODevice::Text))
{
....
}
查看内存,fileName自动变成"./history/ss.txt"了,文件打开失败.
改成
stemp = "ss";
QFile f(QString(".\\histroy\\%1.txt").arg(stemp));
后有些地方打开没问题,有些地方还是存在原来的问题。我用的是qt4.6 Qt creator1.3,Windows下。