QFileInfo file(infoFile); if(!file.exists()) { #if OUTPUT DOutput::instance()->append(tr("The file isn't exist! The path is ")+infoFile); #endif qDebug().noquote()<<tr("The file isn't exist! The path is ")<<infoFile; return; } if(infoFile.isEmpty()) { #if OUTPUT DOutput::instance()->append(tr("The parameter value isn't valid!")+infoFile); #endif qDebug().noquote()<<tr("The parameter value isn't valid!")<<infoFile; } QString path = infoFile.replace("/","\\"); //此行代码至关重要,因为QFileDialog返回的路径都是"/",而程序不能识别 if(!QProcess::startDetached("explorer "+path)) { ShowWarningMessage(this,tr("Warning"),tr("Failed to load document!"),tr("OK")) }