Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QDeclarativeImageProvider for caching images on file?
Forum Updated to NodeBB v4.3 + New Features

QDeclarativeImageProvider for caching images on file?

Scheduled Pinned Locked Moved QML and Qt Quick
21 Posts 4 Posters 11.7k Views 1 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.
  • P Offline
    P Offline
    pdrummond
    wrote on last edited by
    #11

    Hmmm. I think the caching you are seeing when you scroll is not the Disk Cache. I'm sure I have been able to do the same scroll test without having a Disk Cache in place. I will test that again to be sure...

    A better test would be to have a ListView where the items are locally sourced but they include an image that is loaded from the network. When you run the app for the first time, the images will be downloaded, then you shut down the app, turn wifi off, re-run the app and the images should still be displayed because they are automatically sourced from the disk cache.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      minimoog77
      wrote on last edited by
      #12

      [quote author="pdrummond" date="1304604386"]
      A better test would be to have a ListView where the items are locally sourced but they include an image that is loaded from the network. When you run the app for the first time, the images will be downloaded, then you shut down the app, turn wifi off, re-run the app and the images should still be displayed because they are automatically sourced from the disk cache. [/quote]
      That was the test. And not by turn wifi off, I unplugged adsl modem. :) I am pretty sure caching is working.

      And the cache is in C:\Users\myusername\AppData\Local\cache on Win7.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pdrummond
        wrote on last edited by
        #13

        Do your images load if you turn off WiFi then run the app?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          minimoog77
          wrote on last edited by
          #14

          What I have been telling you, :) they load. Cache folder exists with http, https, prepaped folders. In http folder there are cache files cache_*.cache. Cache items contains the header and the compressed image (but I don't think images are compressed).

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pdrummond
            wrote on last edited by
            #15

            Sorry, I just couldn't tell from your posts whether your tests were the same as mine. I am going to write a simple test case and maybe file a bug report on this. Caching simply doesn't work for me :-(

            1 Reply Last reply
            0
            • M Offline
              M Offline
              minimoog77
              wrote on last edited by
              #16

              Sorry to hear that caching for you doesn't work.

              What's the cache directory? Is it created?

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jkosonen
                wrote on last edited by
                #17

                Hey, did you get this to work? I would really appreciate the solution! Thanks!

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  minimoog77
                  wrote on last edited by
                  #18

                  [quote author="jkosonen" date="1313401377"]Hey, did you get this to work? I would really appreciate the solution! Thanks![/quote]

                  It's working for me see https://github.com/minimoog/qtwitdget/blob/master/namfactory.h

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pdrummond
                    wrote on last edited by
                    #19

                    I talked to some of the Qt Dev's on IRC and they were very helpful. In the end it was clear that QNetworkDiskCache isn't designed to solve this problem.

                    So I had no other choice than to hack together my own CachedImage class in C++. I can't make the code available as it was done for a client and also the code is very specialised and not very clean. But if anyone is doing the same thing and have any questions on my implementation I'd be happy to answer them here.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jkosonen
                      wrote on last edited by
                      #20

                      [quote author="pdrummond" date="1313407193"]I talked to some of the Qt Dev's on IRC and they were very helpful. In the end it was clear that QNetworkDiskCache isn't designed to solve this problem.

                      So I had no other choice than to hack together my own CachedImage class in C++. I can't make the code available as it was done for a client and also the code is very specialised and not very clean. But if anyone is doing the same thing and have any questions on my implementation I'd be happy to answer them here.[/quote]

                      I would like to have that kind of an solution, but no idea where to start. Shame that you can't publish the code..

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        minimoog77
                        wrote on last edited by
                        #21

                        [quote author="pdrummond" date="1313407193"]I talked to some of the Qt Dev's on IRC and they were very helpful. In the end it was clear that QNetworkDiskCache isn't designed to solve this problem.

                        So I had no other choice than to hack together my own CachedImage class in C++. I can't make the code available as it was done for a client and also the code is very specialised and not very clean. But if anyone is doing the same thing and have any questions on my implementation I'd be happy to answer them here.[/quote]

                        Did you do your own QAbstractnetworkCache or?

                        1 Reply Last reply
                        0

                        • Login

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