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

QFileSystemModel does not update when the contents of a file changes (file size)

    XMLWordPrintable

Details

    Description

      When I create new files, QFileSystemModel picks up the changes (touch NewFile). However if I change the contents of a file, the view does not get updated (echo "foobar" > NewFile).

      The QFileSystemWatcher does not emit the directoryChanged signal when a file has been modified. The documentation reads: "This signal is emitted when the directory at a specified path, is modified (e.g., when a file is added, modified or deleted) or removed from disk."

      Test case main.cpp to reproduce issue

      #include <QtGui> 
       
      class TreeView : public QTreeView 
      { 
         Q_OBJECT 
      public: 
         TreeView(QWidget *parent = NULL) : QTreeView(parent) { 
             QFileSystemModel *model = new QFileSystemModel(this);; 
             model->setRootPath("/"); 
             setModel(model); 
             setRootIndex(model->index(QDir::currentPath())); 
         } 
      }; 
       
      #include "main.moc" 
       
      int main(int argc, char **argv) 
      { 
          QApplication a(argc, argv); 
          TreeView w; 
          w.show(); 
          return a.exec(); 
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              cnn Qt Core & Network
              mch Jervey Kong
              Votes:
              19 Vote for this issue
              Watchers:
              25 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes