Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QFileSystemWatcher::fileChanged not being triggered, only once the file is closed
I am trying to monitor a file in real time while it is used by another application, but QFileSystemWatcher::fileChanged won't trigger after every changes, only once the file is closed by the application, which is when the application itself is closed.
Is there a way for me to monitor it like i want ? i don't want to use some kind of loop constantly pulling the file data.
that is actually not unexpected. Most file (ReadWrite-Systems) only actually write to the file when you close it or explicitly call flush()
@J.Hilk But it is flushed after each add though, i can manually check changes using visual code and see lines being added while the other application is running, just that (on window at least), QFileSystemWatcher::fileChanged does not trigger until the file is closed.
Which platform ?
@dheerendra Windows 10 64bit
Seems to be a long standing issue/ implementation limitation.
@mrjj Yeah sadly i have read that and hoped there was an alternative.
Well i decided to use QTimer and read only from the last position i was at last iteration.
Since this is a log file, i don't have to worry about modified or deleted data, it can only be added lines.