QFileSystemWatcher new file added
-
wrote on 18 Apr 2019, 21:13 last edited by
How can I trigger a signal with new filename added to a directory using QFileSystemWatcher
-
How can I trigger a signal with new filename added to a directory using QFileSystemWatcher
wrote on 18 Apr 2019, 21:19 last edited by -
wrote on 18 Apr 2019, 21:37 last edited by abdullahzubair109
@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. -
@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
wrote on 18 Apr 2019, 22:47 last edited by@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.
5/5