It searchs recursively in all subfolders until it finds the file or return an empty QString if the file is not found.
QString findFile( QString dir, QString fileName )
{
QDir pathDir( dir );
for( QFileInfo fileInfo : pathDir.entryInfoList() )
{
if( fileInfo.isFile() )
{
if( fileInfo.fileName() == fileName )
return fileInfo.absoluteFilePath();
}
else if( !fileInfo.fileName().endsWith(".") )
{
QString found = findFile( fileInfo.absoluteFilePath(), fileName );
if( !found.isEmpty() ) return found;
}
}
return "";
}