I have done this code in QT in order to open a Directory Dialog, choose a directory and read all the files in it:
QFileDialog dialog;
dialog.setFileMode(QFileDialog::Directory);
dialog.setOption(QFileDialog::ShowDirsOnly);
dialog.setViewMode(QFileDialog::Detail);
int res = dialog.exec();
QDir directory;
if (res) {
directory = dialog.selectedFiles()[0];
QStringList filesList = directory.entryList(QDir::Files);
QString fileName;
foreach(fileName, filesList) {
qDebug() << "FileName " << fileName;
}
}
The problem now is that I would also like to be able to read all the files in the subdirectories of the chosen directory.. do you know how it could be done?