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

QFileSystemWatcher reacts only once on file change

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.11.2
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      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

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

          Activity

            People

            • Assignee:
              thiago Thiago Macieira
              Reporter:
              alekseyka Aleksey Kontsevich
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes