Simple way to figure out if a QFile opened has been externally modified
Hi,
In my text editor application, I would like to know if an opened file has been modified externally by another application in order to allow the user to reload it.
Is there an easy way to know that? I haven't find anything in QFile or QFileInfo classes.
Thanks in advance for your help
Re: Simple way to figure out if a QFile opened has been externally modified
If your filesystem supports it, you can use QFileInfo::lastModified() to check for last modification date and compare it against the time when you saved the file last. But in general this is not reliable. Usually you use QFileSystemWatcher to monitor for modifications.
Re: Simple way to figure out if a QFile opened has been externally modified
wysota thank you very much for your hint!