图像缓存

Qt Quick Ultralite image caching

Qt Quick Ultralite loads all images from flash memory to RAM on startup by default. This approach may limit usable size of RAM and assets size that one can fit into the applications. The problems can be compensated by caching the images.

How to enable caching of images:

  • 设置 QUL_TEXTURE_CACHE CMake variable to desired size in bytes before adding the executable target.
  • 设置 QUL_COPY_TO_RAM resource property to "OnDemand" for individual files. Or make it the default by setting QUL_DEFAULT_COPY_TO_RAM .

The user must choose an appropriate cache size to prevent frequent deletion, which can cause frame drops. The cache size must be at least as big as the biggest single image.

The cache is also used for images that need to be decompressed at runtime.

另请参阅 Default Resource Properties and QUL_COMPRESSION .