PDA

View Full Version : QFileSystemWatcher strange behaviour on Windows7



Talei
10th March 2012, 01:14
Hello,
I wrote application that uses QFileSystemWatcher. Everything working as expected on Windows XP, Linux, but on Windows 7 I have problem.

Scenario:

1. QFileSystemWatcher emits directoryChanged(QString) in the slot connected to this signal I scan directory and add (new) files to the QFileSystemWatcher.

2. Then (and here is problem) when I change content of the file QFileSystemWatcher should emit signal fileChanged(QString) but signal is not emitted. (Strange) But when I go to the directory with the file (or refresh content in the windows explorer of this directory) then fileChanged(QString) is emited!.

If I add file path to QFileSystemWatcher outside of the slot connected to the signal directoryChanged(QString) QFileSystemWatcher correctly emits fileChanged(QString).

I wrote test application and on Windows 7 QFileSystemWatcher works correctly (app does above steps 1 and 2).

This happens only on Windows 7.

The question is why is that happening? I know that the problem lies within app, but I don't know where to look for. The QFileSystemWatcher is on the heap (parent is "this" class) within class (also on heap) that parent is hidden QMainWindow.

Any idea how to track cause of this behaviour is more then welcome.

tbe
10th January 2014, 11:42
We have the same issue here.

If a file, monitored by QFileSystemWatcher is changed, the signal is not emitted until we open the directory in the explorer. After the first time, we open the directory, the workaround does not help anymore. Changes are not recognized anymore.