QFileSystemWatcher
-
Good Morning, today I'm trying to do something test using QFileSystemWatcher class.
Is It possible to know what file is been deleted, renamed, modified programmaticaly in signal directoryChanged and it is possible to know what operation is applied to that file?
For example if I rename a file test.txt contained in a folder called share, can I know via API that file test.txt is renamed instantly? -
Why not add all the files in the dir to the watcher and catch fileChanged() signal?
-
With fileChanged() is it possible know also the operation over that file? For example when renamed file test.txt to test2.txt, FileChanded() says me I have renamed that file test.txt to test2.txt? Can you post me a snippet, please? Thank you so much.
-
You have read the documentation of "QFileSystemWatcher::fileChanged() ":http://doc.qt.nokia.com/4.7/qfilesystemwatcher.html#fileChanged, haven't you?
-
I have read the documentation. FileChanged says me that something is success on that file, but it doesn't say me exactly the operation: rename, delete or modify. I need know exacly what it is happened on that file.
-
You'll have to check this yourself.
There are some issues in the bug tracker that are related to your problem:
- "QTBUG-2264":http://bugreports.qt.nokia.com/browse/QTBUG-2264
- "QTBUG-172":http://bugreports.qt.nokia.com/browse/QTBUG-172, you might want to re-open this one
-
So there isn't a way to do this?
-
No, unfortunately, there is no builtin way to get this information, sorry.
-
Not in Qt as of now. KDE does something better with KDirWatch.
-
I have requested "bug 172":http://bugreports.qt.nokia.com/browse/QTBUG-172 be re-opened. That has been done. You can vote for it now, if you want. Don't count on this being fixed any time soon though, seeing that the priority is not that high.