Qt学习笔记,获取给定目录下面的所有文件名,及其path
QDirModel listmodel;
QString rootpath = "/home/powerlinux/";
QDir dir(rootpath);
//QStringList dirs = dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs);
QStringList dirs = dir.entryList();
for(int i=0; i<dirs.size(); i++){
QModelIndex index = listmodel.index(rootpath+dirs.at(i));
QString filepath = listmodel.filePath(index);
qDebug() <<dirs.at(i)<< "'s index file path" << filepath;
}