Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Find if file exists in QFileSystemModel.
Forum Updated to NodeBB v4.3 + New Features

Find if file exists in QFileSystemModel.

Scheduled Pinned Locked Moved Unsolved General and Desktop
mvc
1 Posts 1 Posters 745 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tokafr
    wrote on 15 Mar 2016, 07:10 last edited by tokafr
    #1

    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 do

    int 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

    1 Reply Last reply
    0

    1/1

    15 Mar 2016, 07:10

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved