Qt编程技巧 返回文件列表

1
QStringList QDir::entryList ( Filters filters = NoFilter, SortFlags sort = NoSort ) const

实例:

1
2
3
4
5
QString path = QFileInfo(fileName).absolutePath();
QDir dir(path);
QStringList filters;
filters<< "*.jpg" << "*.bmp" << "*.png";
fileList = dir.entryList(filters,QDir::Files,QDir::Name);
坚持原创技术分享,您的支持将鼓励我继续创作!