Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 5542

qt-doc-4.8.5-10.fc18.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" />
<!-- qicon.cpp -->
  <title>Qt 4.8: QIcon 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>QIcon</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="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#making-classes-that-use-qicon">Making Classes that Use QIcon</a></li>
</ul>
</div>
<h1 class="title">QIcon Class Reference</h1>
<!-- $$$QIcon-brief -->
<p>The QIcon class provides scalable icons in different modes and states. <a href="#details">More...</a></p>
<!-- @@@QIcon -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QIcon&gt;</span></pre><ul>
<li><a href="qicon-members.html">List of all members, including inherited members</a></li>
<li><a href="qicon-obsolete.html">Obsolete members</a></li>
<li><a href="qicon-qt3.html">Qt 3 support members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#Mode-enum">Mode</a></b> { Normal, Disabled, Active, Selected }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#State-enum">State</a></b> { Off, On }</td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#QIcon">QIcon</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#QIcon-2">QIcon</a></b> ( const QPixmap &amp; <i>pixmap</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#QIcon-3">QIcon</a></b> ( const QIcon &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#QIcon-4">QIcon</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#QIcon-5">QIcon</a></b> ( QIconEngine * <i>engine</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#QIcon-6">QIcon</a></b> ( QIconEngineV2 * <i>engine</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#dtor.QIcon">~QIcon</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#actualSize">actualSize</a></b> ( const QSize &amp; <i>size</i>, Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#addFile">addFile</a></b> ( const QString &amp; <i>fileName</i>, const QSize &amp; <i>size</i> = QSize(), Mode <i>mode</i> = Normal, State <i>state</i> = Off )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#addPixmap">addPixmap</a></b> ( const QPixmap &amp; <i>pixmap</i>, Mode <i>mode</i> = Normal, State <i>state</i> = Off )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QSize&gt; </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#availableSizes">availableSizes</a></b> ( Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint64 </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#cacheKey">cacheKey</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#name">name</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#paint">paint</a></b> ( QPainter * <i>painter</i>, const QRect &amp; <i>rect</i>, Qt::Alignment <i>alignment</i> = Qt::AlignCenter, Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#paint-2">paint</a></b> ( QPainter * <i>painter</i>, int <i>x</i>, int <i>y</i>, int <i>w</i>, int <i>h</i>, Qt::Alignment <i>alignment</i> = Qt::AlignCenter, Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#pixmap">pixmap</a></b> ( const QSize &amp; <i>size</i>, Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#pixmap-5">pixmap</a></b> ( int <i>w</i>, int <i>h</i>, Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#pixmap-6">pixmap</a></b> ( int <i>extent</i>, Mode <i>mode</i> = Normal, State <i>state</i> = Off ) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#swap">swap</a></b> ( QIcon &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#operator-QVariant">operator QVariant</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIcon &amp; </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#operator-eq">operator=</a></b> ( const QIcon &amp; <i>other</i> )</td></tr>
</table>
<a name="static-public-members"></a>
<h2>Static Public Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#fromTheme">fromTheme</a></b> ( const QString &amp; <i>name</i>, const QIcon &amp; <i>fallback</i> = QIcon() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#hasThemeIcon">hasThemeIcon</a></b> ( const QString &amp; <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#setThemeName">setThemeName</a></b> ( const QString &amp; <i>name</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#setThemeSearchPaths">setThemeSearchPaths</a></b> ( const QStringList &amp; <i>paths</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#themeName">themeName</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStringList </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#themeSearchPaths">themeSearchPaths</a></b> ()</td></tr>
</table>
<a name="related-non-members"></a>
<h2>Related Non-Members</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#operator-lt-lt-36">operator&lt;&lt;</a></b> ( QDataStream &amp; <i>stream</i>, const QIcon &amp; <i>icon</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp; </td><td class="memItemRight bottomAlign"><b><a href="qicon.html#operator-gt-gt-25">operator&gt;&gt;</a></b> ( QDataStream &amp; <i>stream</i>, QIcon &amp; <i>icon</i> )</td></tr>
</table>
<a name="details"></a>
<!-- $$$QIcon-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QIcon class provides scalable icons in different modes and states.</p>
<p>A QIcon can generate smaller, larger, active, and disabled pixmaps from the set of pixmaps it is given. Such pixmaps are used by Qt widgets to show an icon representing a particular action.</p>
<p>The simplest use of QIcon is to create one from a <a href="qpixmap.html">QPixmap</a> file or resource, and then use it, allowing Qt to work out all the required icon styles and sizes. For example:</p>
<pre class="cpp"> <span class="type"><a href="qtoolbutton.html">QToolButton</a></span> <span class="operator">*</span>button <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtoolbutton.html">QToolButton</a></span>;
 button<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="type">QIcon</span>(<span class="string">&quot;open.xpm&quot;</span>));</pre>
<p>To undo a QIcon, simply set a null icon in its place:</p>
<pre class="cpp"> button<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="type">QIcon</span>());</pre>
<p>Use the <a href="qimagereader.html#supportedImageFormats">QImageReader::supportedImageFormats</a>() and <a href="qimagewriter.html#supportedImageFormats">QImageWriter::supportedImageFormats</a>() functions to retrieve a complete list of the supported file formats.</p>
<p>When you retrieve a pixmap using pixmap(<a href="qsize.html">QSize</a>, Mode, State), and no pixmap for this given size, mode and state has been added with <a href="qicon.html#addFile">addFile</a>() or <a href="qicon.html#addPixmap">addPixmap</a>(), then QIcon will generate one on the fly. This pixmap generation happens in a <a href="qiconenginev2.html">QIconEngineV2</a>. The default engine scales pixmaps down if required, but never up, and it uses the current style to calculate a disabled appearance. By using custom icon engines, you can customize every aspect of generated icons. With <a href="qiconenginepluginv2.html">QIconEnginePluginV2</a> it is possible to register different icon engines for different file suffixes, making it possible for third parties to provide additional icon engines to those included with Qt.</p>
<p><b>Note:</b> Since Qt 4.2, an icon engine that supports SVG is included.</p>
<a name="making-classes-that-use-qicon"></a>
<h3>Making Classes that Use QIcon</h3>
<p>If you write your own widgets that have an option to set a small pixmap, consider allowing a QIcon to be set for that pixmap. The Qt class <a href="qtoolbutton.html">QToolButton</a> is an example of such a widget.</p>
<p>Provide a method to set a QIcon, and when you draw the icon, choose whichever pixmap is appropriate for the current state of your widget. For example:</p>
<pre class="cpp"> <span class="type">void</span> MyWidget<span class="operator">::</span>drawIcon(<span class="type"><a href="qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span> <span class="type"><a href="qpoint.html">QPoint</a></span> pos)
 {
     <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap <span class="operator">=</span> icon<span class="operator">.</span>pixmap(<span class="type"><a href="qsize.html">QSize</a></span>(<span class="number">22</span><span class="operator">,</span> <span class="number">22</span>)<span class="operator">,</span>
                                    isEnabled() <span class="operator">?</span> <span class="type">QIcon</span><span class="operator">::</span>Normal
                                                : <span class="type">QIcon</span><span class="operator">::</span>Disabled<span class="operator">,</span>
                                    isChecked() <span class="operator">?</span> <span class="type">QIcon</span><span class="operator">::</span>On
                                                : <span class="type">QIcon</span><span class="operator">::</span>Off);
     painter<span class="operator">-</span><span class="operator">&gt;</span>drawPixmap(pos<span class="operator">,</span> pixmap);
 }</pre>
<p>You might also make use of the <tt>Active</tt> mode, perhaps making your widget <tt>Active</tt> when the mouse is over the widget (see <a href="qwidget.html#enterEvent">QWidget::enterEvent</a>()), while the mouse is pressed pending the release that will activate the function, or when it is the currently selected item. If the widget can be toggled, the &quot;On&quot; mode might be used to draw a different icon.</p>
<p class="centerAlign"><img src="images/icon.png" alt="QIcon" /></p></div>
<p><b>See also </b><a href="guibooks.html#fowler">GUI Design Handbook: Iconic Label</a> and <a href="widgets-icons.html">Icons Example</a>.</p>
<!-- @@@QIcon -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Mode$$$Normal$$$Disabled$$$Active$$$Selected -->
<h3 class="fn"><a name="Mode-enum"></a>enum QIcon::<span class="name">Mode</span></h3>
<p>This enum type describes the mode for which a pixmap is intended to be used. The currently defined modes are:</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QIcon::Normal</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">Display the pixmap when the user is not interacting with the icon, but the functionality represented by the icon is available.</td></tr>
<tr><td class="topAlign"><tt>QIcon::Disabled</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">Display the pixmap when the functionality represented by the icon is not available.</td></tr>
<tr><td class="topAlign"><tt>QIcon::Active</tt></td><td class="topAlign"><tt>2</tt></td><td class="topAlign">Display the pixmap when the functionality represented by the icon is available and the user is interacting with the icon, for example, moving the mouse over it or clicking it.</td></tr>
<tr><td class="topAlign"><tt>QIcon::Selected</tt></td><td class="topAlign"><tt>3</tt></td><td class="topAlign">Display the pixmap when the item represented by the icon is selected.</td></tr>
</table>
<!-- @@@Mode -->
<!-- $$$State$$$On$$$Off -->
<h3 class="fn"><a name="State-enum"></a>enum QIcon::<span class="name">State</span></h3>
<p>This enum describes the state for which a pixmap is intended to be used. The <i>state</i> can be:</p>
<table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><tt>QIcon::Off</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">Display the pixmap when the widget is in an &quot;off&quot; state</td></tr>
<tr><td class="topAlign"><tt>QIcon::On</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">Display the pixmap when the widget is in an &quot;on&quot; state</td></tr>
</table>
<!-- @@@State -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QIcon[overload1]$$$QIcon -->
<h3 class="fn"><a name="QIcon"></a>QIcon::<span class="name">QIcon</span> ()</h3>
<p>Constructs a null icon.</p>
<!-- @@@QIcon -->
<!-- $$$QIcon$$$QIconconstQPixmap& -->
<h3 class="fn"><a name="QIcon-2"></a>QIcon::<span class="name">QIcon</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i> )</h3>
<p>Constructs an icon from a <i>pixmap</i>.</p>
<!-- @@@QIcon -->
<!-- $$$QIcon$$$QIconconstQIcon& -->
<h3 class="fn"><a name="QIcon-3"></a>QIcon::<span class="name">QIcon</span> ( const <span class="type">QIcon</span> &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>. This is very fast.</p>
<!-- @@@QIcon -->
<!-- $$$QIcon$$$QIconconstQString& -->
<h3 class="fn"><a name="QIcon-4"></a>QIcon::<span class="name">QIcon</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i> )</h3>
<p>Constructs an icon from the file with the given <i>fileName</i>. The file will be loaded on demand.</p>
<p>If <i>fileName</i> contains a relative path (e.g&#x2e; the filename only) the relevant file must be found relative to the runtime working directory.</p>
<p>The file name can be either refer to an actual file on disk or to one of the application's embedded resources. See the <a href="resources.html">Resource System</a> overview for details on how to embed images and other resource files in the application's executable.</p>
<p>Use the <a href="qimagereader.html#supportedImageFormats">QImageReader::supportedImageFormats</a>() and <a href="qimagewriter.html#supportedImageFormats">QImageWriter::supportedImageFormats</a>() functions to retrieve a complete list of the supported file formats.</p>
<!-- @@@QIcon -->
<!-- $$$QIcon$$$QIconQIconEngine* -->
<h3 class="fn"><a name="QIcon-5"></a>QIcon::<span class="name">QIcon</span> ( <span class="type"><a href="qiconengine.html">QIconEngine</a></span> * <i>engine</i> )</h3>
<p>Creates an icon with a specific icon <i>engine</i>. The icon takes ownership of the engine.</p>
<!-- @@@QIcon -->
<!-- $$$QIcon$$$QIconQIconEngineV2* -->
<h3 class="fn"><a name="QIcon-6"></a>QIcon::<span class="name">QIcon</span> ( <span class="type"><a href="qiconenginev2.html">QIconEngineV2</a></span> * <i>engine</i> )</h3>
<p>Creates an icon with a specific icon <i>engine</i>. The icon takes ownership of the engine.</p>
<!-- @@@QIcon -->
<!-- $$$~QIcon[overload1]$$$~QIcon -->
<h3 class="fn"><a name="dtor.QIcon"></a>QIcon::<span class="name">~QIcon</span> ()</h3>
<p>Destroys the icon.</p>
<!-- @@@~QIcon -->
<!-- $$$actualSize[overload1]$$$actualSizeconstQSize&ModeState -->
<h3 class="fn"><a name="actualSize"></a><span class="type"><a href="qsize.html">QSize</a></span> QIcon::<span class="name">actualSize</span> ( const <span class="type"><a href="qsize.html">QSize</a></span> &amp; <i>size</i>, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>Returns the actual size of the icon for the requested <i>size</i>, <i>mode</i>, and <i>state</i>. The result might be smaller than requested, but never larger.</p>
<p><b>See also </b><a href="qicon.html#pixmap">pixmap</a>() and <a href="qicon.html#paint">paint</a>().</p>
<!-- @@@actualSize -->
<!-- $$$addFile[overload1]$$$addFileconstQString&constQSize&ModeState -->
<h3 class="fn"><a name="addFile"></a><span class="type">void</span> QIcon::<span class="name">addFile</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>fileName</i>, const <span class="type"><a href="qsize.html">QSize</a></span> &amp; <i>size</i> = QSize(), <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off )</h3>
<p>Adds an image from the file with the given <i>fileName</i> to the icon, as a specialization for <i>size</i>, <i>mode</i> and <i>state</i>. The file will be loaded on demand. Note: custom icon engines are free to ignore additionally added pixmaps.</p>
<p>If <i>fileName</i> contains a relative path (e.g&#x2e; the filename only) the relevant file must be found relative to the runtime working directory.</p>
<p>The file name can be either refer to an actual file on disk or to one of the application's embedded resources. See the <a href="resources.html">Resource System</a> overview for details on how to embed images and other resource files in the application's executable.</p>
<p>Use the <a href="qimagereader.html#supportedImageFormats">QImageReader::supportedImageFormats</a>() and <a href="qimagewriter.html#supportedImageFormats">QImageWriter::supportedImageFormats</a>() functions to retrieve a complete list of the supported file formats.</p>
<p>Note: When you add a non-empty filename to a <a href="qicon.html">QIcon</a>, the icon becomes non-null, even if the file doesn't exist or points to a corrupt file.</p>
<p><b>See also </b><a href="qicon.html#addPixmap">addPixmap</a>().</p>
<!-- @@@addFile -->
<!-- $$$addPixmap[overload1]$$$addPixmapconstQPixmap&ModeState -->
<h3 class="fn"><a name="addPixmap"></a><span class="type">void</span> QIcon::<span class="name">addPixmap</span> ( const <span class="type"><a href="qpixmap.html">QPixmap</a></span> &amp; <i>pixmap</i>, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off )</h3>
<p>Adds <i>pixmap</i> to the icon, as a specialization for <i>mode</i> and <i>state</i>.</p>
<p>Custom icon engines are free to ignore additionally added pixmaps.</p>
<p><b>See also </b><a href="qicon.html#addFile">addFile</a>().</p>
<!-- @@@addPixmap -->
<!-- $$$availableSizes[overload1]$$$availableSizesModeState -->
<h3 class="fn"><a name="availableSizes"></a><span class="type"><a href="qlist.html">QList</a></span>&lt;<span class="type"><a href="qsize.html">QSize</a></span>&gt; QIcon::<span class="name">availableSizes</span> ( <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>Returns a list of available icon sizes for the specified <i>mode</i> and <i>state</i>.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@availableSizes -->
<!-- $$$cacheKey[overload1]$$$cacheKey -->
<h3 class="fn"><a name="cacheKey"></a><span class="type"><a href="qtglobal.html#qint64-typedef">qint64</a></span> QIcon::<span class="name">cacheKey</span> () const</h3>
<p>Returns a number that identifies the contents of this <a href="qicon.html">QIcon</a> object. Distinct <a href="qicon.html">QIcon</a> objects can have the same key if they refer to the same contents.</p>
<p>The cacheKey() will change when the icon is altered via <a href="qicon.html#addPixmap">addPixmap</a>() or <a href="qicon.html#addFile">addFile</a>().</p>
<p>Cache keys are mostly useful in conjunction with caching.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qpixmap.html#cacheKey">QPixmap::cacheKey</a>().</p>
<!-- @@@cacheKey -->
<!-- $$$fromTheme[overload1]$$$fromThemeconstQString&constQIcon& -->
<h3 class="fn"><a name="fromTheme"></a><span class="type">QIcon</span> QIcon::<span class="name">fromTheme</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i>, const <span class="type">QIcon</span> &amp; <i>fallback</i> = QIcon() )<tt> [static]</tt></h3>
<p>Returns the <a href="qicon.html">QIcon</a> corresponding to <i>name</i> in the current icon theme. If no such icon is found in the current theme <i>fallback</i> is returned instead.</p>
<p>The latest version of the freedesktop icon specification and naming specification can be obtained here:</p>
<ul>
<li><a href="http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html">http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html</a></li>
<li><a href="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html</a></li>
</ul>
<p>To fetch an icon from the current icon theme:</p>
<pre class="cpp">     <span class="type"><a href="qicon.html">QIcon</a></span> undoicon <span class="operator">=</span> <span class="type"><a href="qicon.html">QIcon</a></span><span class="operator">::</span>fromTheme(<span class="string">&quot;edit-undo&quot;</span>);</pre>
<p>Or if you want to provide a guaranteed fallback for platforms that do not support theme icons, you can use the second argument:</p>
<pre class="cpp">     <span class="type"><a href="qicon.html">QIcon</a></span> undoicon <span class="operator">=</span> <span class="type"><a href="qicon.html">QIcon</a></span><span class="operator">::</span>fromTheme(<span class="string">&quot;edit-undo&quot;</span><span class="operator">,</span> <span class="type"><a href="qicon.html">QIcon</a></span>(<span class="string">&quot;:/undo.png&quot;</span>));</pre>
<p><b>Note:</b> By default, only X11 will support themed icons. In order to use themed icons on Mac and Windows, you will have to bundle a compliant theme in one of your <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>() and set the appropriate <a href="qicon.html#themeName">themeName</a>().</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qicon.html#themeName">themeName</a>(), <a href="qicon.html#setThemeName">setThemeName</a>(), and <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>().</p>
<!-- @@@fromTheme -->
<!-- $$$hasThemeIcon[overload1]$$$hasThemeIconconstQString& -->
<h3 class="fn"><a name="hasThemeIcon"></a><span class="type">bool</span> QIcon::<span class="name">hasThemeIcon</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> )<tt> [static]</tt></h3>
<p>Returns true if there is an icon available for <i>name</i> in the current icon theme, otherwise returns false.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qicon.html#themeSearchPaths">themeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#setThemeName">setThemeName</a>().</p>
<!-- @@@hasThemeIcon -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a><span class="type">bool</span> QIcon::<span class="name">isNull</span> () const</h3>
<p>Returns true if the icon is empty; otherwise returns false.</p>
<p>An icon is empty if it has neither a pixmap nor a filename.</p>
<p>Note: Even a non-null icon might not be able to create valid pixmaps, eg. if the file does not exist or cannot be read.</p>
<!-- @@@isNull -->
<!-- $$$name[overload1]$$$name -->
<h3 class="fn"><a name="name"></a><span class="type"><a href="qstring.html">QString</a></span> QIcon::<span class="name">name</span> () const</h3>
<p>Returns the name used to create the icon, if available.</p>
<p>Depending on the way the icon was created, it may have an associated name. This is the case for icons created with <a href="qicon.html#fromTheme">fromTheme</a>() or icons using a <a href="qiconengine.html">QIconEngine</a> which supports the <a href="qiconenginev2.html#IconEngineHook-enum">QIconEngineV2::IconNameHook</a>.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also </b><a href="qicon.html#fromTheme">fromTheme</a>() and <a href="qiconengine.html">QIconEngine</a>.</p>
<!-- @@@name -->
<!-- $$$paint[overload1]$$$paintQPainter*constQRect&Qt::AlignmentModeState -->
<h3 class="fn"><a name="paint"></a><span class="type">void</span> QIcon::<span class="name">paint</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i>, const <span class="type"><a href="qrect.html">QRect</a></span> &amp; <i>rect</i>, <span class="type"><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></span> <i>alignment</i> = Qt::AlignCenter, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>Uses the <i>painter</i> to paint the icon with specified <i>alignment</i>, required <i>mode</i>, and <i>state</i> into the rectangle <i>rect</i>.</p>
<p><b>See also </b><a href="qicon.html#actualSize">actualSize</a>() and <a href="qicon.html#pixmap">pixmap</a>().</p>
<!-- @@@paint -->
<!-- $$$paint$$$paintQPainter*intintintintQt::AlignmentModeState -->
<h3 class="fn"><a name="paint-2"></a><span class="type">void</span> QIcon::<span class="name">paint</span> ( <span class="type"><a href="qpainter.html">QPainter</a></span> * <i>painter</i>, <span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>, <span class="type"><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a></span> <i>alignment</i> = Qt::AlignCenter, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>This is an overloaded function.</p>
<p>Paints the icon into the rectangle <a href="qrect.html">QRect</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>).</p>
<!-- @@@paint -->
<!-- $$$pixmap[overload1]$$$pixmapconstQSize&ModeState -->
<h3 class="fn"><a name="pixmap"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> QIcon::<span class="name">pixmap</span> ( const <span class="type"><a href="qsize.html">QSize</a></span> &amp; <i>size</i>, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>Returns a pixmap with the requested <i>size</i>, <i>mode</i>, and <i>state</i>, generating one if necessary. The pixmap might be smaller than requested, but never larger.</p>
<p><b>See also </b><a href="qicon-qt3.html#setPixmap" class="compat">setPixmap</a>(), <a href="qicon.html#actualSize">actualSize</a>(), and <a href="qicon.html#paint">paint</a>().</p>
<!-- @@@pixmap -->
<!-- $$$pixmap$$$pixmapintintModeState -->
<h3 class="fn"><a name="pixmap-5"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> QIcon::<span class="name">pixmap</span> ( <span class="type">int</span> <i>w</i>, <span class="type">int</span> <i>h</i>, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a pixmap of size <a href="qsize.html">QSize</a>(<i>w</i>, <i>h</i>). The pixmap might be smaller than requested, but never larger.</p>
<!-- @@@pixmap -->
<!-- $$$pixmap$$$pixmapintModeState -->
<h3 class="fn"><a name="pixmap-6"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> QIcon::<span class="name">pixmap</span> ( <span class="type">int</span> <i>extent</i>, <span class="type"><a href="qicon.html#Mode-enum">Mode</a></span> <i>mode</i> = Normal, <span class="type"><a href="qicon.html#State-enum">State</a></span> <i>state</i> = Off ) const</h3>
<p>This is an overloaded function.</p>
<p>Returns a pixmap of size <a href="qsize.html">QSize</a>(<i>extent</i>, <i>extent</i>). The pixmap might be smaller than requested, but never larger.</p>
<!-- @@@pixmap -->
<!-- $$$setThemeName[overload1]$$$setThemeNameconstQString& -->
<h3 class="fn"><a name="setThemeName"></a><span class="type">void</span> QIcon::<span class="name">setThemeName</span> ( const <span class="type"><a href="qstring.html">QString</a></span> &amp; <i>name</i> )<tt> [static]</tt></h3>
<p>Sets the current icon theme to <i>name</i>.</p>
<p>The <i>name</i> should correspond to a directory name in the themeSearchPath() containing an index.theme file describing it's contents.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qicon.html#themeSearchPaths">themeSearchPaths</a>() and <a href="qicon.html#themeName">themeName</a>().</p>
<!-- @@@setThemeName -->
<!-- $$$setThemeSearchPaths[overload1]$$$setThemeSearchPathsconstQStringList& -->
<h3 class="fn"><a name="setThemeSearchPaths"></a><span class="type">void</span> QIcon::<span class="name">setThemeSearchPaths</span> ( const <span class="type"><a href="qstringlist.html">QStringList</a></span> &amp; <i>paths</i> )<tt> [static]</tt></h3>
<p>Sets the search paths for icon themes to <i>paths</i>.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qicon.html#themeSearchPaths">themeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#setThemeName">setThemeName</a>().</p>
<!-- @@@setThemeSearchPaths -->
<!-- $$$swap[overload1]$$$swapQIcon& -->
<h3 class="fn"><a name="swap"></a><span class="type">void</span> QIcon::<span class="name">swap</span> ( <span class="type">QIcon</span> &amp; <i>other</i> )</h3>
<p>Swaps icon <i>other</i> with this icon. This operation is very fast and never fails.</p>
<p>This function was introduced in Qt 4.8.</p>
<!-- @@@swap -->
<!-- $$$themeName[overload1]$$$themeName -->
<h3 class="fn"><a name="themeName"></a><span class="type"><a href="qstring.html">QString</a></span> QIcon::<span class="name">themeName</span> ()<tt> [static]</tt></h3>
<p>Returns the name of the current icon theme.</p>
<p>On X11, the current icon theme depends on your desktop settings. On other platforms it is not set by default.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qicon.html#setThemeName">setThemeName</a>(), <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#hasThemeIcon">hasThemeIcon</a>().</p>
<!-- @@@themeName -->
<!-- $$$themeSearchPaths[overload1]$$$themeSearchPaths -->
<h3 class="fn"><a name="themeSearchPaths"></a><span class="type"><a href="qstringlist.html">QStringList</a></span> QIcon::<span class="name">themeSearchPaths</span> ()<tt> [static]</tt></h3>
<p>Returns the search paths for icon themes.</p>
<p>The default value will depend on the platform:</p>
<p>On X11, the search path will use the XDG_DATA_DIRS environment variable if available.</p>
<p>By default all platforms will have the resource directory <tt>:\icons</tt> as a fallback. You can use &quot;rcc -project&quot; to generate a resource file from your icon theme.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also </b><a href="qicon.html#setThemeSearchPaths">setThemeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#setThemeName">setThemeName</a>().</p>
<!-- @@@themeSearchPaths -->
<!-- $$$operator QVariant[overload1]$$$operator QVariant -->
<h3 class="fn"><a name="operator-QVariant"></a>QIcon::<span class="name">operator QVariant</span> () const</h3>
<p>Returns the icon as a <a href="qvariant.html">QVariant</a>.</p>
<!-- @@@operator QVariant -->
<!-- $$$operator=[overload1]$$$operator=constQIcon& -->
<h3 class="fn"><a name="operator-eq"></a><span class="type">QIcon</span> &amp; QIcon::<span class="name">operator=</span> ( const <span class="type">QIcon</span> &amp; <i>other</i> )</h3>
<p>Assigns the <i>other</i> icon to this icon and returns a reference to this icon.</p>
<!-- @@@operator= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator<<$$$operator<<QDataStream&constQIcon& -->
<h3 class="fn"><a name="operator-lt-lt-36"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&lt;&lt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, const <span class="type">QIcon</span> &amp; <i>icon</i> )</h3>
<p>Writes the given <i>icon</i> to the given <i>stream</i> as a PNG image. If the icon contains more than one image, all images will be written to the stream. Note that writing the stream to a file will not produce a valid image file.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>$$$operator>>QDataStream&QIcon& -->
<h3 class="fn"><a name="operator-gt-gt-25"></a><span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <span class="name">operator&gt;&gt;</span> ( <span class="type"><a href="qdatastream.html">QDataStream</a></span> &amp; <i>stream</i>, <span class="type">QIcon</span> &amp; <i>icon</i> )</h3>
<p>Reads an image, or a set of images, from the given <i>stream</i> into the given <i>icon</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@operator>> -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc and/or its
      subsidiaries. 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>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      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>