PDA

View Full Version : Signal in Qt which emits its signal if a file is pasted in a directory?



Qiieha
1st April 2011, 20:48
Hi
I have a little problem. I'm writing a console programm which should watch a directory. If a file is pasted, the programm should do some work. I'm using the QFileSystemWatcher, but he also emits a signal when a file gets deleted.
The signal should be emitted when a file is pasted. Do you have some suggestions?
Maybe I have ti write my own signal? But how?

Thank you!

wysota
1st April 2011, 21:23
Use QFileWatcher and compare the directory contents before the signal and after the signal and you'll know wheter a new file appeared or not.

Qiieha
2nd April 2011, 12:47
Thank you for your reply! Ok a good idea, but I can't find a class named QFileWatcher.
I use Qt 4.7...

wysota
2nd April 2011, 13:13
Sorry, should be QFileSystemWatcher.