I have a directory with 2 files: Test1.txt and test2.txt
This code should list me the two files:
QDirIterator *it;
QStringList nameFilters;
nameFilters << "t*.txt";
QString path = "C:/temp/test";
qDebug() << "nameFilters" << nameFilters;
it = new QDirIterator(path, nameFilters, QDir::NoFilter, QDirIterator::Subdirectories);
while (it->hasNext()) {
QString filename = it->next();
qDebug() << "filename" << filename;
}
but the output is :
nameFilters ("t*.txt")
filename "C:/temp/test/test2.txt"
Note that this code works well:
QDir dir(path);
qDebug() << dir.entryList(nameFilters, QDir::NoFilter);
Outputs for QDir :
entryList ("Test1.txt", "test2.txt")