QFileInfo Caching



  • Hi I have a simple technical question - in the official QFileInfo class reference page it says:

    Note: To speed up performance, QFileInfo caches information about the file.

    I need to retrieve file size and last modified date/time from files. Is this information cached upon construction of the QFileInfo object? If not is it cached after calling the relevant methods lastmodified() and size()?

    If that information is cached in either of these ways, if I pass QFileInfo objects with cached data from a worker thread to a main gui thread using signals/slots will the information stay cached?

    Thanks for the help.


  • Lifetime Qt Champion

    Hi,

    From a quick look at the sources, it looks like the informations are cached when accessed the first time. Note that you can also disable the caching mechanism if needed.



  • Thank SGaist. Does the info persist as cached when moved from worker thread to main gui thread via signal/slot?


  • Lifetime Qt Champion

    Again from a quick look at the code, the cache data are not tied to any thread.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.