Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54608

QML Image not cached when loaded from network



    • Type: Suggestion
    • Status: Closed
    • Priority: P5: Not important
    • Resolution: Out of scope
    • Affects Version/s: 5.7.0
    • Fix Version/s: None
    • Labels:



      From the http://doc.qt.io/qt-5/qml-qtquick-image.html documentation I'm not sure if this is expected but here it is.

      If you run example attached below you will see that images are fetched as you scroll. Since hidden delegates get destroyed images will once again be fetched from server when we scroll back. Given that there is cache property on Image I would expect that this would mean images are cached on disk. There is also some mention of this in sourceSize property:

      Note: Changing this property dynamically causes the image source to be reloaded, potentially even from the network, if it is not in the disk cache.

      Here is example code:

      import QtQuick 2.6
      import QtQuick.Window 2.2
          visible: true
          width: 1024
          height: 512
              orientation: ListView.Horizontal
              width: parent.width
              height: parent.height / 2
              delegate: Image
                  width: 512
                  height: 512
                  fillMode: Image.Stretch
                  source: modelData
                  cache: true // this is default

      I have my own simple caching mechanism for images which works as expected on all platforms tested (osx, linux, ios, android). I have C++ function called from Javascript which is used as a proxy for Image source property. If there is no image locally, it is fetched and saved to disk (QStandardPaths::CacheLocation) first and then source property is always set to local image path.

      We have this in production for a year now but, if possible, I would much rather use existing caching from Image or implement it myself if it sounds interesting.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            • Assignee:
              w00t Robin Burchell
              pkoretic Petar Koretic
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes