QPixmapCache man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



QPixmapCache(3qt)				QPixmapCache(3qt)

NAME
       QPixmapCache - Application-global cache for pixmaps

       #include <qpixmapcache.h>

   Static Public Members
       int cacheLimit ()

       void setCacheLimit ( int )

       QPixmap* find ( const QString & key )

       bool find ( const QString & key, QPixmap & )

       bool insert ( const QString & key, QPixmap * ) (obsolete)

       void insert ( const QString & key, const QPixmap & )

       void clear ()

DESCRIPTION
       The QPixmapCache class provides an application-global
       cache for pixmaps.

       This class is a tool for optimized drawing with QPixmap.
       You can use it to store temporary pixmaps that are
       expensive to generate, without using more storage space
       than cacheLimit(). Use insert() to insert pixmaps, find()
       to find them and clear() to empty the cache.

       Here follows an example. QRadioButton has a non-trivial
       visual representation. In the function
       QRadioButton::drawButton(), we do not draw the radio
       button directly. Instead, we first check the global pixmap
       cache for a pixmap with the key "$qt_radio_nnn_", where
       nnn is a numerical value that specifies the the radio
       button state. If a pixmap is found, we bitBlt() it onto
       the widget and return. Otherwise, we create a new pixmap,
       draw the radio button in the pixmap and finally insert the
       pixmap in the global pixmap cache, using the key above.
       The bitBlt() is 10 times faster than drawing the radio
       button. All radio buttons in the program share the cached
       pixmap since QPixmapCache is application-global.

       QPixmapCache contains no member data, only static
       functions to access the global pixmap cache. It creates an
       internal QCache for caching the pixmaps.

       The cache associates a pixmap with a normal string (key).
       If two pixmaps are inserted into the cache using equal
       keys, then the last pixmap will hide the first pixmap. The
       QDict and QCache classes do exactly the same.

Trolltech AS		   13 June 2001				1

QPixmapCache(3qt)				QPixmapCache(3qt)

       The cache becomes full when the total size of all pixmaps
       in the cache exceeds cacheLimit(). The initial cache limit
       is 1024 KByte (1 MByte); it is changed with
       setCacheLimit(). A pixmap takes roughly
       width*height*depth/8 bytes of memory.

       See the QCache documentation for more details about the
       cache mechanism.

MEMBER FUNCTION DOCUMENTATION
int QPixmapCache::cacheLimit () [static]
       Returns the cache limit (in kilobytes).

       The default setting is 1024 kilobytes.

       See also setCacheLimit().

void QPixmapCache::clear () [static]
       Removes all pixmaps from the cache.

QPixmap * QPixmapCache::find ( const QString & key ) [static]
       Returns the pixmap associated with key in the cache, or
       null if there is no such pixmap.

	NOTE: if valid, you should copy the pixmap immediately
       (this is quick since QPixmaps are implicitly shared),
       because subsequent insertions into the cache could cause
       the pointer to become invalid. For this reason, we
       recommend you use find(const QString&, QPixmap&) instead.

       Example:

	   QPixmap* pp;
	   QPixmap p;
	   if ( (pp=QPixmapCache::find("my_previous_copy", pm)) ) {
	       p = *pp;
	   } else {
	       p.load("bigimage.png");
	       QPixmapCache::insert("my_previous_copy", new QPixmap(p));
	   }
	   painter->drawPixmap(0, 0, p);

bool QPixmapCache::find ( const QString & key, QPixmap & pm )
       [static]
       Looks for a cached pixmap associated with key in the
       cache. If a pixmap is found, the function sets pm to that
       pixmap and returns TRUE. Otherwise, the function returns
       FALSE and does not change pm.

       Example:

	   QPixmap p;
	   if ( !QPixmapCache::find("my_previous_copy", pm) ) {
	       pm.load("bigimage.png");

Trolltech AS		   13 June 2001				2

QPixmapCache(3qt)				QPixmapCache(3qt)

	       QPixmapCache::insert("my_previous_copy", pm);
	   }
	   painter->drawPixmap(0, 0, p);

bool QPixmapCache::insert ( const QString & key, QPixmap * pm )
       [static]
       This function is obsolete. It is provided to keep old
       source working, and will probably be removed in a future
       version of Qt. We strongly advise against using it in new
       code.

       Inserts the pixmap pm associated with key into the cache.
       Returns TRUE if successful, or FALSE if the pixmap is too
       big for the cache.

	NOTE: pm must be allocated on the heap (using new).

       If this function returns FALSE, you must delete pm
       yourself.

       If this function returns TRUE, do not use pm afterwards or
       keep references to it, as any other insertions into the
       cache, from anywhere in the application, or within Qt
       itself, could cause the pixmap to be discarded from the
       cache, and the pointer to become invalid.

       Due to these dangers, we strongly recommend that you use
       insert(const QString&, const QPixmap&) instead.

void QPixmapCache::insert ( const QString & key, const QPixmap &
       pm ) [static]
       Inserts a copy of the pixmap pm associated with key into
       the cache.

       All pixmaps inserted by the Qt library have a key starting
       with "$qt..". Use something else for your own pixmaps.

       When a pixmap is inserted and the cache is about to exceed
       its limit, it removes pixmaps until there is enough room
       for the pixmap to be inserted.

       The oldest pixmaps (least recently accessed in the cache)
       are deleted when more space is needed.

       See also setCacheLimit().

void QPixmapCache::setCacheLimit ( int n ) [static]
       Sets the cache limit to n kilobytes.

       The default setting is 1024 kilobytes.

       See also	 cacheLimit().

Trolltech AS		   13 June 2001				3

QPixmapCache(3qt)				QPixmapCache(3qt)

SEE ALSO
       http://doc.trolltech.com/qpixmapcache.html
       http://www.trolltech.com/faq/tech.html

COPYRIGHT
       Copyright 1992-2001 Trolltech AS,
       http://www.trolltech.com.  See the license file included
       in the distribution for a complete license statement.

AUTHOR
       Generated automatically from the source code.

BUGS
       If you find a bug in Qt, please report it as described in
       http://doc.trolltech.com/bughowto.html.	Good bug reports
       make our job much simpler. Thank you.

       In case of content or formattting problems with this
       manual page, please report them to qt-bugs@trolltech.com.
       Please include the name of the manual page
       (qpixmapcache.3qt) and the Qt version (2.3.1).

Trolltech AS		   13 June 2001				4

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net