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. Caching many PNG images-files in one go.

Caching many PNG images-files in one go.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 841 Views
  • 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.
  • S Offline
    S Offline
    Snoopy
    wrote on last edited by
    #1

    Hello,

    In my Qt Quick Application I want to cache 120 image-files in PNG-Format by set the property cache = true for the Image items. Every image with a size below 20 KB. So in total not more than 2.5 MB.

    1. question: Which negative consequences or problems are to expected by caching all the images ?

    2.question: At the moment there are 120 Images items in my application. Everyone with property cache = true. But I'm skeptical that this is the correct way. Has somebody an idea how to do that correctly ?
    Maybe dynamically creating with a loop when the application is starting. I'm not sure.

    Thanks. Best regards

    Snoopy

    timdayT 1 Reply Last reply
    0
    • S Snoopy

      Hello,

      In my Qt Quick Application I want to cache 120 image-files in PNG-Format by set the property cache = true for the Image items. Every image with a size below 20 KB. So in total not more than 2.5 MB.

      1. question: Which negative consequences or problems are to expected by caching all the images ?

      2.question: At the moment there are 120 Images items in my application. Everyone with property cache = true. But I'm skeptical that this is the correct way. Has somebody an idea how to do that correctly ?
      Maybe dynamically creating with a loop when the application is starting. I'm not sure.

      Thanks. Best regards

      Snoopy

      timdayT Offline
      timdayT Offline
      timday
      wrote on last edited by timday
      #2

      @Snoopy Does the application have any knowledge of which images are likely to be needed next? For example, does it just cycle through them as an animation? Or are they used by a collection of screens/pages such that from any given page the user can only see certain images and only access certain other pages which use a certain subset of the images?

      I've found QQuickImageProvider http://doc.qt.io/qt-5/qquickimageprovider.html to be useful for implementing various behaviours attempting to be smarter (or more tuned for the application) than Qt's own default cache logic. Part of the problem certainly used to be that the cache isn't actually that big... there's an interesting bug https://bugreports.qt.io/browse/QTBUG-19507 from back in the "declarative" days... I've no idea how big it is these days. BTW I believe images are cached uncompressed... so they could be occupying considerably more than 20KB each in the QtQuick image cache. If you loaded them via a QQuickImageProvider you can take a lot more control over what form they're cached in.

      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