I want to get the names of image files (*.png, *.jpg, *.bmp) from a folder.
What I could do so far is this :
fileInfoList = dir.entryInfoList(QDir::Files|QDir::NoDotAndDotDot);
But how to get only the *.png, *.bmp and *.jpg files ?
Something like this should work;
QStringList filters;
filters << "*.png" << "*.jpg" << "*.bmp";
fileInfoList = dir.entryInfoList(filters, QDir::Files|QDir::NoDotAndDotDot);
See this for more info.
You can also use the QDir::setNameFilters function to set the filters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With