qint64 GetFolderSize(QString folder)
{
QDir dir(folder)
if (!dir.exists())
return 0
qint64 totalsize = 0
QFileInfoList list = dir.entryInfoList()
for(int ii=0 ii<list.size() ii++)
{
QFileInfo fileInfo = list.at(ii)
if (fileInfo.isFile())
totalsize += fileInfo.size()
else if(fileInfo.isDir())
{
totalsize += GetFolderSize(fileInfo.path)
}
}
return totalsize
}
QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filters = NoFilter, SortFlags sort = NoSort) const欢迎分享,转载请注明来源:内存溢出
评论列表(0条)