[Interest] QFileSystemWatcher malfunctioning

Bo Thorsen bo at fioniasoftware.dk
Thu Jan 12 09:14:33 CET 2012


Den 12-01-2012 08:35, Andreas Pakulat skrev:
> On 12.01.12 08:01:17, Sujan Dasmahapatra wrote:
>> Dear Friends
>>
>> I am using QFileSystemWatcher for knowing when the file is modified from
>> outside my application. I am seeing even if the file is modified from
>> the application this is giving message that the file is modified. Can
>> anyone tell whats going wrong in this..see the snippet below
>
> There is nothing going wrong here, thats how QFileSystemWatcher is
> intended to work. If you don't want to be notified for changes you're
> doing yourself you need to add code for that in your application.

And this is of course the task for a SignalBlocker. I've done exactly 
this (block QFileSystemWatcher) for a customer a couple of months ago, 
and it really is the only solution.

I just put my SignalBlocker implementation on my blog:

http://www.fioniasoftware.dk/blog/?p=158

(Sorry for the plug but it was a bit long for a mail, and there might be 
other interested in it.)

With this class you just do this:

{
   SignalBlocker blocker(watcher);
   modifyTheFile();
}

I hope this helps.

Bo Thorsen,
Fionia Software.

-- 

Expert Qt and C++ developer for hire
Contact me if you need expert Qt help
http://www.fioniasoftware.dk



More information about the Interest mailing list