Sophie

Sophie

distrib > Mageia > 7 > x86_64 > by-pkgid > 1dd17e0d683ef79b4bb6872bbf359d7f > files > 6147

qt4-doc-4.8.7-26.2.mga7.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qpixmapcache.cpp -->
  <title>Qt 4.8: QPixmapCache Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtgui.html">QtGui</a></li>
<li>QPixmapCache</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QPixmapCache Class Reference</h1>
<!-- $$$QPixmapCache-brief -->
<p>The QPixmapCache class provides an application-wide cache for pixmaps. <a href="#details">More...</a></p>
<!-- @@@QPixmapCache -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QPixmapCache&gt;</span></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="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> class </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache-key.html">Key</a></b></td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#cacheLimit">cacheLimit</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#clear">clear</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#find">find</a></b> ( const QString &amp; <i>key</i>, QPixmap * <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#find-3">find</a></b> ( const Key &amp; <i>key</i>, QPixmap * <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#insert">insert</a></b> ( const QString &amp; <i>key</i>, const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Key </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#insert-2">insert</a></b> ( const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#remove">remove</a></b> ( const QString &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#remove-2">remove</a></b> ( const Key &amp; <i>key</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#replace">replace</a></b> ( const Key &amp; <i>key</i>, const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a></b> ( int <i>n</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QPixmapCache-description -->
<div class="descr">
<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 user-provided string as a key, or with a <a href="qpixmapcache-key.html">QPixmapCache::Key</a> that the cache generates. Using <a href="qpixmapcache-key.html">QPixmapCache::Key</a> for keys is faster than using strings. The string API is very convenient for complex keys but the <a href="qpixmapcache-key.html">QPixmapCache::Key</a> API will be very efficient and convenient for a one-to-one object-to-pixmap mapping &mdash; in this case, you can store the keys as members of an object.</p>
<p>If two pixmaps are inserted into the cache using equal keys then the last pixmap will replace the first pixmap in the cache. This follows the behavior of the <a href="qhash.html">QHash</a> and <a href="qcache.html">QCache</a> classes.</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 2048 KB (2 MB) on embedded platforms, 10240 KB (10 MB) on desktop platforms; you can change this by calling <a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>() with the required value. 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.qt.digia.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>
</div>
<p><b>See also </b><a href="qcache.html">QCache</a> and <a href="qpixmap.html">QPixmap</a>.</p>
<!-- @@@QPixmapCache -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$cacheLimit[overload1]$$$cacheLimit -->
<h3 class="fn"><a name="cacheLimit"></a><span class="type">int</span> QPixmapCache::<span class="name">cacheLimit</span> ()<tt> [static]</tt></h3>
<p>Returns the cache limit (in kilobytes).</p>
<p>The default cache limit is 2048 KB on embedded platforms, 10240 KB on desktop platforms.</p>
<p><b>See also </b><a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>().</p>
<!-- @@@cacheLimit -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn"><a name="clear"></a><span class="type">void</span> QPixmapCache::<span class="name">clear</span> ()<tt> [static]</tt></h3>
<p>Removes all pixmaps from the cache.</p>
<!-- @@@clear -->
<!-- $$$find[overload1]$$$findconstQString&QPixmap* -->
<h3 class="fn"><a name="find"></a><span class="type">bool</span> QPixmapCache::<span class="name">find</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, <span class="type"><a href="qpixmap.html">QPixmap</a></span> * <i>pixmap</i> )<tt> [static]</tt></h3>
<p>Looks for a cached pixmap associated with the given <i>key</i> in the cache. If the pixmap is found, the function sets <i>pixmap</i> to that pixmap and returns true; otherwise it leaves <i>pixmap</i> alone and returns false.</p>
<p>Example:</p>
<pre class="cpp"> <span class="type"><a href="qpixmap.html">QPixmap</a></span> pm;
 <span class="keyword">if</span> (<span class="operator">!</span><span class="type"><a href="qpixmapcache.html">QPixmapCache</a></span><span class="operator">::</span>find(<span class="string">&quot;my_big_image&quot;</span><span class="operator">,</span> <span class="operator">&amp;</span>pm)) {
     pm<span class="operator">.</span>load(<span class="string">&quot;bigimage.png&quot;</span>);
     <span class="type"><a href="qpixmapcache.html">QPixmapCache</a></span><span class="operator">::</span>insert(<span class="string">&quot;my_big_image&quot;</span><span class="operator">,</span> pm);
 }
 painter<span class="operator">-</span><span class="operator">&gt;</span>drawPixmap(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> pm);</pre>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@find -->
<!-- $$$find$$$findconstKey&QPixmap* -->
<h3 class="fn"><a name="find-3"></a><span class="type">bool</span> QPixmapCache::<span class="name">find</span> ( const <span class="type"><a href="qpixmapcache-key.html">Key</a></span> &amp; <i>key</i>, <span class="type"><a href="qpixmap.html">QPixmap</a></span> * <i>pixmap</i> )<tt> [static]</tt></h3>
<p>Looks for a cached pixmap associated with the given <i>key</i> in the cache. If the pixmap is found, the function sets <i>pixmap</i> to that pixmap and returns true; otherwise it leaves <i>pixmap</i> alone and returns false. If the pixmap is not found, it means that the <i>key</i> is no longer valid, so it will be released for the next insertion.</p>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@find -->
<!-- $$$insert[overload1]$$$insertconstQString&constQPixmap& -->
<h3 class="fn"><a name="insert"></a><span class="type">bool</span> QPixmapCache::<span class="name">insert</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )<tt> [static]</tt></h3>
<p>Inserts a copy of the pixmap <i>pixmap</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><b>See also </b><a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>().</p>
<!-- @@@insert -->
<!-- $$$insert$$$insertconstQPixmap& -->
<h3 class="fn"><a name="insert-2"></a><span class="type"><a href="qpixmapcache-key.html">Key</a></span> QPixmapCache::<span class="name">insert</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )<tt> [static]</tt></h3>
<p>Inserts a copy of the given <i>pixmap</i> into the cache and returns a key that can be used to retrieve it.</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>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>() and <a href="qpixmapcache.html#replace">replace</a>().</p>
<!-- @@@insert -->
<!-- $$$remove[overload1]$$$removeconstQString& -->
<h3 class="fn"><a name="remove"></a><span class="type">void</span> QPixmapCache::<span class="name">remove</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>key</i> )<tt> [static]</tt></h3>
<p>Removes the pixmap associated with <i>key</i> from the cache.</p>
<!-- @@@remove -->
<!-- $$$remove$$$removeconstKey& -->
<h3 class="fn"><a name="remove-2"></a><span class="type">void</span> QPixmapCache::<span class="name">remove</span> ( const <span class="type"><a href="qpixmapcache-key.html">Key</a></span> &amp; <i>key</i> )<tt> [static]</tt></h3>
<p>Removes the pixmap associated with <i>key</i> from the cache and releases the key for a future insertion.</p>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@remove -->
<!-- $$$replace[overload1]$$$replaceconstKey&constQPixmap& -->
<h3 class="fn"><a name="replace"></a><span class="type">bool</span> QPixmapCache::<span class="name">replace</span> ( const <span class="type"><a href="qpixmapcache-key.html">Key</a></span> &amp; <i>key</i>, const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )<tt> [static]</tt></h3>
<p>Replaces the pixmap associated with the given <i>key</i> with the <i>pixmap</i> specified. Returns true if the <i>pixmap</i> has been correctly inserted into the cache; otherwise returns false.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qpixmapcache.html#setCacheLimit">setCacheLimit</a>() and <a href="qpixmapcache.html#insert">insert</a>().</p>
<!-- @@@replace -->
<!-- $$$setCacheLimit[overload1]$$$setCacheLimitint -->
<h3 class="fn"><a name="setCacheLimit"></a><span class="type">void</span> QPixmapCache::<span class="name">setCacheLimit</span> ( <span class="type">int</span> <i>n</i> )<tt> [static]</tt></h3>
<p>Sets the cache limit to <i>n</i> kilobytes.</p>
<p>The default setting is 2048 KB on embedded platforms, 10240 KB on desktop platforms.</p>
<p><b>See also </b><a href="qpixmapcache.html#cacheLimit">cacheLimit</a>().</p>
<!-- @@@setCacheLimit -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
      Documentation contributions included herein are the copyrights of
      their respective owners.</p>
    <br />
    <p>
      The documentation provided herein is licensed under the terms of the
      <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
      License version 1.3</a> as published by the Free Software Foundation.</p>
    <p>
      Documentation sources may be obtained from <a href="http://www.qt-project.org">
      www.qt-project.org</a>.</p>
    <br />
    <p>
      Qt and respective logos are trademarks of The Qt Company Ltd 
      in Finland and/or other countries worldwide. All other trademarks are property
      of their respective owners. <a title="Privacy Policy"
      href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
  </div>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>