QString FindFile(const QString &strFilePath, const QString &strNameFilters)
{
 if (strFilePath.isEmpty() || strNameFilters.isEmpty())
 {
  return QString();
 }

QDir dir;
    QStringList filters;

filters << strNameFilters;
    dir.setPath(strFilePath);
    dir.setNameFilters(filters);
    QDirIterator iter(dir,QDirIterator::Subdirectories);

while (iter.hasNext())
    {
        iter.next();
        QFileInfo info=iter.fileInfo();
        if (info.isFile())
  {
   return info.absoluteFilePath().replace('/', '\\');
        }
    }

return QString();
}

http://blog.csdn.net/itjobtxq/article/details/8350985

05-11 11:35