Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-33720

QFileSystemModel stops watching folder after rename

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.1.0 , 5.1.1
    • Core: Item Models
    • Windows 7 64-bit

    Description

      I have a QFileSystemModel with a QTreeView to view and edit files and folders on my hard drive. I have the QFileSystemModel read only set to false so I can rename folders.

      Problem:
      I have a folder 'A' open in the QTreeView. I can drag a file using Windows Explorer into folder 'A' and I can see this file in my QTreeView. This works as expected.
      However, if I rename the folder to 'B' in the QTreeView (using F2), when I drag a file into 'B' using Windows Explorer it no longer shows up in QTreeView.

      The fileRenamed signal is being triggered from QFileSystemModel and the folder is being renamed correctly.

      The QFileSystemModel documentation states that there is a QFileSystemWatcher installed to watch the file system. The documentation for QFileSystem states:

      "QFileSystemWatcher stops monitoring files once they have been renamed or removed from disk, and directories once they have been removed from disk."

      What I am observing is that QFileSystemWatcher stops monitoring directories after they have been renamed, which is not consistent with the documentation.

      In addition, I cannot find a simple way to tell the internal QFileSystemWatcher to start watching the renamed folder again.

      Attachments

        1. filesystemmodel-bug-lq.mov
          2.84 MB
          Kimo Johnson
        2. QTreeViewDemo.zip
          4 kB
          Kimo Johnson

        Activity

          People

            dfaure_kdab David Faure
            mkimojohnson Kimo Johnson
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated: