Results 1 to 2 of 2

Thread: QPixmapCache calculating needed cache

  1. #1
    Join Date
    Nov 2010
    Posts
    31
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPixmapCache calculating needed cache

    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

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QPixmapCache calculating needed cache

    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()?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. Calculating the column width in a wiew
    By lotek in forum Newbie
    Replies: 0
    Last Post: 9th November 2011, 18:50
  2. Calculating button width
    By Skizmo in forum Qt Programming
    Replies: 6
    Last Post: 17th February 2011, 15:12
  3. Calculating best bounding box for text
    By xtal256 in forum Qt Programming
    Replies: 2
    Last Post: 1st October 2010, 07:38
  4. Problem with QPixmapCache
    By christina123y in forum Qt Programming
    Replies: 1
    Last Post: 28th July 2009, 07:49
  5. calculating checksum in serialcommunication
    By jjbabu in forum Qt Programming
    Replies: 5
    Last Post: 12th October 2007, 12:43

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.