Find if file exists in QFileSystemModel.
Unsolved
General and Desktop
-
Hi
I want to to create a Folder with mkdir of QFileSystemModel. But I want to create with name "New Folder" and if "New Folder" already exists create "New Folder(1)". So Firstly I want to find out it "New Folder" already exists. How can I find it?
for now I doint count = 0; QModelIndex fileIndex = FileModel_ -> index(nameToCheck); while (FileModel_ -> fileInfo(fileIndex).exists()) { nameToCheck = name + "(" + (++count) + ")"; fileIndex = FileModel_ -> index(nameToCheck); } FileModel_ -> mkdir(parentDir, nameToCheck);
Where FileModel_ is an object of QFileSystemModel.
thanks