I'm writing log files and would like to set a size limit of 10 Mo.
I was thinking of setting a QTimer triggering every X minutes/hours QFileInfo::refresh and checking the size of the file.
Would there be a better way to do this? Using a QTimer sounds painful and resource-costly to me. I wish I could use a SIGNAL when the limit size is reached.
Simple and working solution is to read a file size with
QFile::size()right after writing to a log file and react if the size exceeds the limit. Note that the file must be opened when the size is read.