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

QFileSystemWatcher reacts only once on file change

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important P2: Important
    • 5.12
    • 5.11.2
    • None
    • Linux/X11

      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.

        1. qtbug-72227.7z
          1 kB
          Kai Köhne
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes