[Qt-interest] QFileSystemWatcher missing file changes?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Mar 17 10:00:37 CET 2010


Bob Hood wrote on Tuesday, March 16, 2010 11:15 PM:

> ...
> Unfortunately, QFileSystemWatcher doesn't behave the way I expect it
> to.  When watching a folder, it generates events for file additions
> and removals, but does not report that the folder had a change when a
> file is modified -- i.e., it's time stamp changes.

>From the docs: "The fileChanged() signal is emitted when a file has been modified, renamed or removed from disk. Similarly, the directoryChanged() signal is emitted when a directory or its contents is modified or removed."

I find this also a bit confusing, but I guess fileChanged() is really only emitted for a file - a file which has been explicitly added before with addFile(). But you would never get a fileChanged() signal if you only add a directory path, because modifying a directory only causes directoryChanged() to be emitted. And "modifying a directory or its contents" seems to mean:

- delete or rename the directory

- delete or add files to that directory (rename files?)

So I believe with "content" is really meant the content of the directory itself - the list of files - but not the content of the files themselves.

But I agree that the use-case you have does really scream for such an extended functionallity ("add a directory path and get notified when files therein change - maybe just direct children, not files in subdirectories, as to simplify the task"). Maybe you could add it as a feature request? If you say that at least on Windows there exists an API for that chances are that other platforms offer something similar and it could be added to a later Qt :)

  http://bugreports.qt.nokia.com/secure/Dashboard.jspa


Cheers, 
  Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list