QFileSystemWatcher
-
wrote on 1 Apr 2011, 11:14 last edited by
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? -
wrote on 1 Apr 2011, 11:23 last edited by
Why not add all the files in the dir to the watcher and catch fileChanged() signal?
-
wrote on 1 Apr 2011, 11:39 last edited by
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.
-
wrote on 1 Apr 2011, 12:23 last edited by
You have read the documentation of "QFileSystemWatcher::fileChanged() ":http://doc.qt.nokia.com/4.7/qfilesystemwatcher.html#fileChanged, haven't you?
-
wrote on 1 Apr 2011, 12:43 last edited by
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.
-
wrote on 1 Apr 2011, 13:02 last edited by
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
-
wrote on 4 Apr 2011, 06:57 last edited by
So there isn't a way to do this?
-
wrote on 4 Apr 2011, 07:24 last edited by
No, unfortunately, there is no builtin way to get this information, sorry.
-
wrote on 4 Apr 2011, 07:29 last edited by
Not in Qt as of now. KDE does something better with KDirWatch.
-
wrote on 4 Apr 2011, 08:44 last edited by
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.
5/10