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.

Remove non empty directory with QFileSystemModel.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qfilesystemmodeqdir
4 Posts 2 Posters 2.6k 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 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      T 1 Reply Last reply
      0
      • mrjjM mrjj

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

        T Offline
        T Offline
        tokafr
        wrote on last edited by
        #3

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

        mrjjM 1 Reply Last reply
        0
        • T tokafr

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

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on 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

          • Login

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