PDA

View Full Version : QPixmapCache calculating needed cache



franki
9th April 2013, 15:05
Hello,

I have problem with setting up proper pixmap cache size. My files are in png format, mostly small icons.
In docs there is info that estimated pixmap size is width*height*depth/8 this is I suppose in bytes, so divide by 1024 to get size in kb.
This calculation is roughly the same as file size on disk.

QPixmapCache::setCacheLimit(int n) where n is in kilobytes, should correspond with what I calculated about pixmap sizes, but is not. I need to set much larger limit, about ten times to be sure.

So could someone tell me how to calculate QPixmapCache used size ?

And second issue, I have noticed that setting up new cacheLimit clears QPixmapCache. I don't see any info about that in docs, is that correct ?
I'm using Necessitas 4.8.2 on armv7, will try this later on Linux platform.

best regards
Marek

Santosh Reddy
20th April 2013, 20:00
QPixmapCache::setCacheLimit(int n) where n is in kilobytes, should correspond with what I calculated about pixmap sizes, but is not.
How can you it not? Does QPixmapCache::find() does not find the image are you inserted earlier using QPixmapCache::insert()?