⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qiconset.html

📁 QT 下载资料仅供参考
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- /home/reggie/tmp/qt-3.0-reggie-5401/qt-x11-commercial-3.0.5/src/kernel/qiconset.cpp:95 --><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>QIconSet Class</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: #ffffff; color: black; }--></style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr bgcolor="#E5E5E5"><td valign=center> <a href="index.html"><font color="#004faf">Home</font></a> | <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a> | <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a> | <a href="annotated.html"><font color="#004faf">Annotated</font></a> | <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a> | <a href="functions.html"><font color="#004faf">Functions</font></a></td><td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QIconSet Class Reference</h1><p>The QIconSet class provides a set of icons with different styles and sizes.<a href="#details">More...</a><p><tt>#include &lt;<a href="qiconset-h.html">qiconset.h</a>&gt;</tt><p><a href="qiconset-members.html">List of all member functions.</a><h2>Public Members</h2><ul><li><div class=fn>enum <a href="#Size-enum"><b>Size</b></a> { Automatic, Small, Large }</div></li><li><div class=fn>enum <a href="#Mode-enum"><b>Mode</b></a> { Normal, Disabled, Active }</div></li><li><div class=fn>enum <a href="#State-enum"><b>State</b></a> { On, Off }</div></li><li><div class=fn><a href="#QIconSet"><b>QIconSet</b></a> ()</div></li><li><div class=fn><a href="#QIconSet-2"><b>QIconSet</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pixmap, Size&nbsp;size = Automatic )</div></li><li><div class=fn><a href="#QIconSet-3"><b>QIconSet</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;smallPix, const&nbsp;QPixmap&nbsp;&amp;&nbsp;largePix )</div></li><li><div class=fn><a href="#QIconSet-4"><b>QIconSet</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;other )</div></li><li><div class=fn>virtual <a href="#~QIconSet"><b>~QIconSet</b></a> ()</div></li><li><div class=fn>void <a href="#reset"><b>reset</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm, Size&nbsp;size )</div></li><li><div class=fn>virtual void <a href="#setPixmap"><b>setPixmap</b></a> ( const&nbsp;QPixmap&nbsp;&amp;&nbsp;pm, Size&nbsp;size, Mode&nbsp;mode = Normal, State&nbsp;state = Off )</div></li><li><div class=fn>virtual void <a href="#setPixmap-2"><b>setPixmap</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;fileName, Size&nbsp;size, Mode&nbsp;mode = Normal, State&nbsp;state = Off )</div></li><li><div class=fn>QPixmap <a href="#pixmap"><b>pixmap</b></a> ( Size&nbsp;size, Mode&nbsp;mode, State&nbsp;state = Off ) const</div></li><li><div class=fn>QPixmap <a href="#pixmap-2"><b>pixmap</b></a> ( Size&nbsp;size, bool&nbsp;enabled, State&nbsp;state = Off ) const</div></li><li><div class=fn>QPixmap <a href="#pixmap-3"><b>pixmap</b></a> () const</div></li><li><div class=fn>bool <a href="#isGenerated"><b>isGenerated</b></a> ( Size&nbsp;size, Mode&nbsp;mode, State&nbsp;state = Off ) const</div></li><li><div class=fn>void <a href="#clearGenerated"><b>clearGenerated</b></a> ()</div></li><li><div class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</div></li><li><div class=fn>void <a href="#detach"><b>detach</b></a> ()</div></li><li><div class=fn>QIconSet &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;other )</div></li></ul><h2>Static Public Members</h2><ul><li><div class=fn>void <a href="#setIconSize"><b>setIconSize</b></a> ( Size&nbsp;s, const&nbsp;QSize&nbsp;&amp;&nbsp;size )</div></li><li><div class=fn>const QSize &amp; <a href="#iconSize"><b>iconSize</b></a> ( Size&nbsp;s )</div></li></ul><hr><a name="details"></a><h2>Detailed Description</h2> <p> The QIconSet class provides a set of icons with different styles and sizes.<p> <p> A QIconSet can generate smaller, larger, active, and disabled pixmapsfrom the set of icons it is given. Such pixmaps are used by<a href="qtoolbutton.html">QToolButton</a>, <a href="qheader.html">QHeader</a>, <a href="qpopupmenu.html">QPopupMenu</a>, etc. to show an icon representing aparticular action.<p> The simplest use of QIconSet is to create one from a <a href="qpixmap.html">QPixmap</a> and thenuse it, allowing Qt to work out all the required icon styles andsizes. For example:<p> <pre>  <a href="qtoolbutton.html">QToolButton</a> *tb = new <a href="qtoolbutton.html">QToolButton</a>( <a href="#QIconSet">QIconSet</a>( QPixmap("open.xpm") ), ... );  </pre> <p> Using whichever <a href="#pixmap">pixmap</a>(s) you specify as a base,QIconSet provides a set of six icons, each witha <a href="#Size-enum">Size</a> anda <a href="#Mode-enum">Mode</a>:<ul><li> <em>Small Normal</em> - can only be calculated from Large Normal.<li> <em>Small Disabled</em> - calculated from Large Disabled or Small Normal.<li> <em>Small Active</em> - same as Small Normal unless you set it.<li> <em>Large Normal</em> - can only be calculated from Small Normal.<li> <em>Large Disabled</em> - calculated from Small Disabled or Large Normal.<li> <em>Large Active</em> - same as Large Normal unless you set it.</ul><p> An additional set of six icons can be provided for widgets that havean "On" or "Off" state, like checkable menu items or toggleabletoolbuttons. If you provide pixmaps for the "On" state, but not forthe "Off" state, the QIconSet will provide the "Off" pixmaps. You mayspecify icons for both states in you wish. For best results forcalculated pixmaps, you should supply a 22 x 22 pixel pixmap.<p> You can set any of the icons using <a href="#setPixmap">setPixmap</a>().<p> When you retrieve a pixmap using <a href="#pixmap">pixmap</a>(Size,Mode,State), QIconSetwill return the icon that has been set or previously generated forthat size, mode and state combination. If no pixmap has been set orpreviously generated for the combination QIconSet will generate apixmap based on the pixmap(s) it has been given, cache the generatedpixmap for later use, and return it. The <a href="#isGenerated">isGenerated</a>() functionreturns TRUE if an icon was generated by QIconSet.<p> The <a href="#Mode-enum">Disabled</a> appearance is computed using a "shadow" algorithmthat produces results very similar to those used in MicrosoftWindows 95.<p> The <a href="#Mode-enum">Active</a> appearance is identical to the <a href="#Mode-enum">Normal</a> appearanceunless you use setPixmap() to set it to something special.<p> When scaling icons, QIconSet uses <a href="qimage.html#smoothScale">smooth scaling</a>, which can partially blend the color componentof pixmaps.  If the results look poor, the best solutionis to supply pixmaps in both large and small sizes.<p> You can use the static function <a href="#setIconSize">setIconSize</a>() to set the preferredsize of the generated large/small icons. The default small size is22x22 (compatible with Qt 2.x), while the default large sizeis 32x32. Please note that these sizes only affect generated icons.<p> QIconSet provides a function, <a href="#isGenerated">isGenerated</a>(), that indicates whetheran icon was set by the application programmer or computed byQIconSet itself.<p> <h3> Making Classes that use QIconSet</h3><a name="1"></a><p> If you write your own widgets that have an option to set a smallpixmap, consider allowing a QIconSet to be set for that pixmap.  TheQt class <a href="qtoolbutton.html">QToolButton</a> is an example of such a widget.<p> Provide a method to set a QIconSet, and when you draw the icon, choosewhichever icon is appropriate for the current state of your widget.For example:<pre>  void MyWidget::drawIcon( <a href="qpainter.html">QPainter</a>* p, QPoint pos )  {      p-&gt;<a href="qpainter.html#drawPixmap">drawPixmap</a>( pos, icons-&gt;pixmap(QIconSet::<a href="#Size-enum">Small</a>, isEnabled()) );  }  </pre> <p> You might also make use of the Active mode, perhaps making your widgetActive 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 activatethe function, or when it is the currently selected item. If the widgetcan be toggled, the "On" mode might be used to draw a different icon.<p> <center><img src="iconset.png" alt="QIconSet"></center> <p> <p>See also <a href="qpixmap.html">QPixmap</a>, <a href="qlabel.html">QLabel</a>, <a href="qtoolbutton.html">QToolButton</a>, <a href="qpopupmenu.html">QPopupMenu</a>, <a href="qmainwindow.html#usesBigPixmaps-prop">QMainWindow::usesBigPixmaps</a>, <a href="guibooks.html#fowler">GUI Design Handbook: Iconic Label</a>, <a href="http://cgl.microsoft.com/clipgallerylive/cgl30/eula.asp?nInterface=0	">Microsoft Icon Gallery</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a> and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.<hr><h2>Member Type Documentation</h2><h3 class=fn><a name="Mode-enum"></a>QIconSet::Mode</h3><p> This enum type describes the mode for which a pixmap is intended to beused.The currently defined modes are:<ul><li><tt>QIconSet::Normal</tt> - Display the pixmap when the user isnot interacting with the icon, but thefunctionality represented by the icon is available.<li><tt>QIconSet::Disabled</tt> - Display the pixmap when thefunctionality represented by the icon is not available.<li><tt>QIconSet::Active</tt> - Display the pixmap when thefunctionality represented by the icon is available andthe user is interacting with the icon, for example, moving themouse over it or clicking it.</ul><h3 class=fn><a name="Size-enum"></a>QIconSet::Size</h3>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -