Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > ac91357d6caede925de099a02fced14e > files > 4483

qt4-doc-4.2.1-1.el5_7.1.x86_64.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/gui/image/qpixmapcache.cpp -->
<head>
  <title>Qt 4.2: QPixmapCache Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QPixmapCache Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1>
<p>The QPixmapCache class provides an application-wide cache for pixmaps. <a href="#details">More...</a></p>
<pre> #include &lt;QPixmapCache&gt;</pre><ul>
<li><a href="qpixmapcache-members.html">List of all members, including inherited members</a></li>
<li><a href="qpixmapcache-obsolete.html">Obsolete members</a></li>
</ul>
<a name="static-public-members"></a>
<h3>Static Public Members</h3>
<ul>
<li><div class="fn"/>int <b><a href="qpixmapcache.html#cacheLimit">cacheLimit</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qpixmapcache.html#clear">clear</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qpixmapcache.html#find">find</a></b> ( const QString &amp; <i>key</i>, QPixmap &amp; <i>pm</i> )</li>
<li><div class="fn"/>bool <b><a href="qpixmapcache.html#insert">insert</a></b> ( const QString &amp; <i>key</i>, const QPixmap &amp; <i>pm</i> )</li>
<li><div class="fn"/>void <b><a href="qpixmapcache.html#remove">remove</a></b> ( const QString &amp; <i>key</i> )</li>
<li><div class="fn"/>void <b><a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a></b> ( int <i>n</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QPixmapCache class provides an application-wide cache for pixmaps.</p>
<p>This class is a tool for optimized drawing with <a href="qpixmap.html">QPixmap</a>. You can use it to store temporary pixmaps that are expensive to generate without using more storage space than <a href="qpixmapcache.html#cacheLimit">cacheLimit</a>(). Use <a href="qpixmapcache.html#insert">insert</a>() to insert pixmaps, <a href="qpixmapcache.html#find">find</a>() to find them, and <a href="qpixmapcache.html#clear">clear</a>() to empty the cache.</p>
<p>QPixmapCache contains no member data, only static functions to access the global pixmap cache. It creates an internal <a href="qcache.html">QCache</a> object for caching the pixmaps.</p>
<p>The cache associates a pixmap with a string (key). If two pixmaps are inserted into the cache using equal keys, then the last pixmap will hide the first pixmap. The <a href="qhash.html">QHash</a> and <a href="qcache.html">QCache</a> classes do exactly the same.</p>
<p>The cache becomes full when the total size of all pixmaps in the cache exceeds <a href="qpixmapcache.html#cacheLimit">cacheLimit</a>(). The initial cache limit is 1024 KB (1 MB); it is changed with <a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>(). A pixmap takes roughly (<i>width</i> * <i>height</i> * <i>depth</i>)/8 bytes of memory.</p>
<p>The <i>Qt Quarterly</i> article <a href="http://doc.trolltech.com/qq/qq12-qpixmapcache.html">Optimizing with QPixmapCache</a> explains how to use QPixmapCache to speed up applications by caching the results of painting.</p>
<p>See also <a href="qcache.html">QCache</a> and <a href="qpixmap.html">QPixmap</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="cacheLimit"></a>int QPixmapCache::cacheLimit ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the cache limit (in kilobytes).</p>
<p>The default setting is 1024 kilobytes.</p>
<p>See also <a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>().</p>
<h3 class="fn"><a name="clear"></a>void QPixmapCache::clear ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Removes all pixmaps from the cache.</p>
<h3 class="fn"><a name="find"></a>bool QPixmapCache::find ( const <a href="qstring.html">QString</a> &amp; <i>key</i>, <a href="qpixmap.html">QPixmap</a> &amp; <i>pm</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Looks for a cached pixmap associated with the <i>key</i> in the cache. If the pixmap is found, the function sets <i>pm</i> to that pixmap and returns true; otherwise it leaves <i>pm</i> alone and returns false.</p>
<p>Example:</p>
<pre> QPixmap pm;
 if (!QPixmapCache::find(&quot;my_big_image&quot;, pm)) {
     pm.load(&quot;bigimage.png&quot;);
     QPixmapCache::insert(&quot;my_big_image&quot;, pm);
 }
 painter-&gt;drawPixmap(0, 0, pm);</pre>
<h3 class="fn"><a name="insert"></a>bool QPixmapCache::insert ( const <a href="qstring.html">QString</a> &amp; <i>key</i>, const <a href="qpixmap.html">QPixmap</a> &amp; <i>pm</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Inserts a copy of the pixmap <i>pm</i> associated with the <i>key</i> into the cache.</p>
<p>All pixmaps inserted by the Qt library have a key starting with &quot;$qt&quot;, so your own pixmap keys should never begin &quot;$qt&quot;.</p>
<p>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.</p>
<p>The oldest pixmaps (least recently accessed in the cache) are deleted when more space is needed.</p>
<p>The function returns true if the object was inserted into the cache; otherwise it returns false.</p>
<p>See also <a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>().</p>
<h3 class="fn"><a name="remove"></a>void QPixmapCache::remove ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Removes the pixmap associated with <i>key</i> from the cache.</p>
<h3 class="fn"><a name="setCacheLimit"></a>void QPixmapCache::setCacheLimit ( int <i>n</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Sets the cache limit to <i>n</i> kilobytes.</p>
<p>The default setting is 1024 kilobytes.</p>
<p>See also <a href="qpixmapcache.html#cacheLimit">cacheLimit</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2006 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.2.1</div></td>
</tr></table></div></address></body>
</html>