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. Remove non empty directory with QFileSystemModel.
Forum Updated to NodeBB v4.3 + New Features

Remove non empty directory with QFileSystemModel.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qfilesystemmodeqdir
4 Posts 2 Posters 2.7k Views 1 Watching
  • 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 4 Apr 2016, 09:13 last edited by
    #1

    Hello
    I have a trouble with deleting the directory using rmdir of QFileSystemModel object.
    It only removes empty directories. but returns false if the directory is not empty.
    Do you have any Idea?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 4 Apr 2016, 09:24 last edited by
      #2

      hi
      maybe you can use
      http://doc.qt.io/qt-5/qdir.html#removeRecursively

      T 1 Reply Last reply 4 Apr 2016, 10:21
      0
      • M mrjj
        4 Apr 2016, 09:24

        hi
        maybe you can use
        http://doc.qt.io/qt-5/qdir.html#removeRecursively

        T Offline
        T Offline
        tokafr
        wrote on 4 Apr 2016, 10:21 last edited by
        #3

        @mrjj
        I am using qt-4.8 :) I don't have this method there.

        M 1 Reply Last reply 4 Apr 2016, 10:25
        0
        • T tokafr
          4 Apr 2016, 10:21

          @mrjj
          I am using qt-4.8 :) I don't have this method there.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 4 Apr 2016, 10:25 last edited by
          #4

          @tokafr
          Oh. That would have been too easy then :)

          http://stackoverflow.com/questions/11050977/removing-a-non-empty-folder-in-qt
          has a function that looks good.
          bool removeDir(const QString & dirName)
          make sure to give it full path.

          I dont think QFileSystemModel can do it directly .
          Not that i have seen.

          1 Reply Last reply
          1

          3/4

          4 Apr 2016, 10:21

          • Login

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