Important: Please read the Qt Code of Conduct -

[Solved] QML Image not loading over http

  • My app running on iOS was working perfectly than all of a sudden the images being loaded from an Akamai CDN stopped loading. The strange part is - it is not all of them. Some do load after the app is restarted. The images that do load in the list view do not show in the detail view, even though the url is the exact same.

    I set up a network disk cache and provided that to the QML engine; with it on or off the same problem still persists.

    I'm not sure if this is due to upgrading from 5.2 to 5.3.1 ( I believe it was working with 5.3.1 for a while)

    QML doesn't print any errors and adding an onStatusChanged handler only logs Loading status, it never gets to another status. The few images that do load do set the status to Ready.

    I know that the images exists and the browser loads them in under 0.5 seconds.

    Loading the images in C++ works fine, all the requests complete with no errors.

    QML code is just a list view with a row that contains an image and the model comes from c++ providing the url to load

    Any help will be greatly appreciated.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you provide a minimal sample code that reproduce the problematic behavior ?

  • I couldn't reproduce it in a simple example, so I determined it must be something related to the application.

    I changed the root of the application to a StackView instead of just hiding the non visible screens and that reduced the memory footprint considerably and the images started working again.

    I am not sure if it was a memory issue as the app only used 150mb and didn't report out of memory or if there was a simultaneous action that was causing the images not to load.

    It is fixed and probably structured better now.

  • Lifetime Qt Champion

    Nice you found out and improved your code !

    Happy coding !

Log in to reply