Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFileInfo Caching
Qt 6.11 is out! See what's new in the release blog

QFileInfo Caching

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 594 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Crag_Hack
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Crag_Hack
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved