static void fillFilePathsRecursive(const QDir& dir, QMultiMap<QByteArray, QByteArray>& sourceFilePaths) { QStringList subDirs(dir.entryList(QDir::Dirs|QDir::NoDotAndDotDot|QDir::Readable)); int i=subDirs.size(); while(--i>=0) fillFilePathsRecursive(QDir(dir.filePath(subDirs.at(i))),sourceFilePaths); static QStringList filters = QStringList(QStringLiteral("*.cpp")) <<QStringLiteral("*.c") <<QStringLiteral("*.cc") <<QStringLiteral("*.mm") <<QStringLiteral("*.ui") <<QStringLiteral("*rc"); QStringList files(dir.entryList(filters, QDir::Files|QDir::NoDotAndDotDot|QDir::Readable)); i=files.size(); QByteArray absDirPath=dir.absolutePath().toUtf8(); absDirPath.squeeze(); while(--i>=0) { //qDebug()<<files.at(i)<<absDirPath; QByteArray fn=files.at(i).toUtf8(); fn.squeeze(); auto it=sourceFilePaths.constFind(fn); if (it!=sourceFilePaths.constEnd()) sourceFilePaths.insert(it.key(), absDirPath); //avoid having identical qbytearray objects to save memory else sourceFilePaths.insert(fn, absDirPath); } }