View Full Version : how to get the added file name when using QFileSystemWatcher

13th February 2007, 04:02
i use QFileSystemWatcher to watch some directory, when i add a file to it, I can get the signal well, but now the question is how to get the added file name? QFileSystemWatcher NOW seemed to have no method to do it directly.

13th February 2007, 09:42
120993 - Add a newFile() signal to QFileSystemWatcher (http://www.trolltech.com/developer/task-tracker/index_html?method=entry&id=120993)

13th February 2007, 11:23
This feature, along other improvements have been suggested over and over again during the testing-cycle of Qt-4.2 preleases due to the inability of QFileSystemWatcher to provide more details about the event that caused the signal(s). Yet, as of now nothing indicates that these shortcomings will be addressed int Qt's near future releases. The solution is to build a custom class to carry out the monitoring of files and directories.

This shouldn't be too hard using your operating systems native directoy-monitoring facilities if your code is only intended to run on a single platform. it will however be much more difficult to implement this as a platform independet solution. I needed to write such a class on linux a while ago, so I resorted to using fam (or gamin which is API compatible to fam) and it wasn't too much of labour implementing it.
good luck!

21st August 2009, 12:39
The future looks dim on this one, task 182019 (http://qt.nokia.com/developer/task-tracker/index_html?method=entry&id=182019) is set to "wont fix".