delTree has been replaced by QDir::removeRecursively() (Qt5) (Qt4 support has been dropped)

This commit is contained in:
Luis Ángel San Martín
2014-10-22 21:34:57 +02:00
parent e9a487db5e
commit 463aae7b8a
4 changed files with 5 additions and 34 deletions

View File

@ -1,24 +1 @@
#include "custom_widgets.h"
#include <QDir>
#include <QFileInfo>
void delTree(QDir dir)
{
dir.setFilter(QDir::AllDirs|QDir::Files|QDir::Hidden|QDir::NoDotAndDotDot);
QFileInfoList list = dir.entryInfoList();
for (int i = 0; i < list.size(); ++i)
{
QFileInfo fileInfo = list.at(i);
QString path = fileInfo.filePath();
if(fileInfo.isDir())
{
delTree(QDir(fileInfo.absoluteFilePath()));
dir.rmdir(fileInfo.absoluteFilePath());
}
else
{
dir.remove(fileInfo.absoluteFilePath());
}
}
}