Solved QFileSystemWatcher new file added
-
How can I trigger a signal with new filename added to a directory using QFileSystemWatcher
-
-
@JonB no... It will return the directory where new file added or renamed or removed.. Not the path for newly added file.. Correct me if I am wrong
-
Hi,
If you need that level of details, may QFileSystemModel would be more interesting. You can use the rowsInserted signal to grab the information you are after.
Otherwise, you should keep a list of the entries of the folder you are watching in order to compare it to it's new content when
directoryChanged
is called. -
@abdullahzubair109
QFileSystemWatcher::directoryChanged
signal is as good as it gets :) You have to figure out what got added. I'm not sure whether @SGaist is sayingQFileSystemModel::rowsInserted
can be used to automatically monitor changes in the background.