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

QFileSystemWatcher reacts only once on file change

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.11.2
    • None
    • Linux/X11

    Description

      Catching file change in following way:

          QFileSystemWatcher watcher;
          QFileInfo file(url.toLocalFile());
          watcher.addPath(file.absoluteFilePath());
          connect(&watcher, &QFileSystemWatcher::fileChanged, this, &MyClass::mySlot);
      

      slot receives signal only once, then QFileSystemWatcher does not react on any file change. To catch file changes use following workaround - added following lines:

          qmlWatcher.addPath(file.absolutePath());
          connect(&watcher, &QFileSystemWatcher::directoryChanged, this, &MyClass::mySlot);
      

      In this case able to catch all further file modifications.

      Attachments

        Issue Links

          Activity

            People

              thiago Thiago Macieira
              jirauser39314 user-45b5b (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: