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

📄 qiconset.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
字号:
'\" t.TH QIconSet 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQIconSet \- Set of icons with different styles and sizes.SH SYNOPSIS\fC#include <qiconset.h>\fR.PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBSize\fR { Automatic, Small, Large }".br.ti -1c.BI "enum \fBMode\fR { Normal, Disabled, Active }".br.ti -1c.BI "enum \fBState\fR { On, Off }".br.ti -1c.BI "\fBQIconSet\fR ()".br.ti -1c.BI "\fBQIconSet\fR ( const QPixmap & pixmap, Size size = Automatic )".br.ti -1c.BI "\fBQIconSet\fR ( const QPixmap & smallPix, const QPixmap & largePix )".br.ti -1c.BI "\fBQIconSet\fR ( const QIconSet & other )".br.ti -1c.BI "virtual \fB~QIconSet\fR ()".br.ti -1c.BI "void \fBreset\fR ( const QPixmap & pixmap, Size size )".br.ti -1c.BI "virtual void \fBsetPixmap\fR ( const QPixmap & pixmap, Size size, Mode mode = Normal, State state = Off )".br.ti -1c.BI "virtual void \fBsetPixmap\fR ( const QString & fileName, Size size, Mode mode = Normal, State state = Off )".br.ti -1c.BI "QPixmap \fBpixmap\fR ( Size size, Mode mode, State state = Off ) const".br.ti -1c.BI "QPixmap pixmap ( Size size, bool enabled, State state = Off ) const  \fI(obsolete)\fR".br.ti -1c.BI "QPixmap \fBpixmap\fR () const".br.ti -1c.BI "bool \fBisGenerated\fR ( Size size, Mode mode, State state = Off ) const".br.ti -1c.BI "void \fBclearGenerated\fR ()".br.ti -1c.BI "void \fBinstallIconFactory\fR ( QIconFactory * factory )".br.ti -1c.BI "bool \fBisNull\fR () const".br.ti -1c.BI "void \fBdetach\fR ()".br.ti -1c.BI "QIconSet & \fBoperator=\fR ( const QIconSet & other )".br.ti -1c.BI "\fBQ_DUMMY_COMPARISON_OPERATOR\fR ( QIconSet )".br.ti -1c.BI "QPixmap * \fBcreateScaled\fR ( Size size, const QPixmap * suppliedPix ) const".br.ti -1c.BI "QPixmap * \fBcreateDisabled\fR ( Size size, State state ) const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "void \fBsetIconSize\fR ( Size which, const QSize & size )".br.ti -1c.BI "const QSize & \fBiconSize\fR ( Size which )".br.in -1c.SH DESCRIPTIONThe QIconSet class provides a set of icons with different styles and sizes..PPA QIconSet can generate smaller, larger, active, and disabled pixmaps from the set of icons it is given. Such pixmaps are used by QToolButton, QHeader, QPopupMenu, etc. to show an icon representing a particular action..PPThe simplest use of QIconSet is to create one from a QPixmap and then use it, allowing Qt to work out all the required icon styles and sizes. For example:.PP.nf.br    QToolButton *but = new QToolButton( QIconSet( QPixmap("open.xpm") ), ... );.br.fi.PPUsing whichever pixmaps you specify as a base, QIconSet provides a set of six icons, each with a Size and a Mode: Small Normal, Small Disabled, Small Active, Large Normal, Large Disabled, and Large Active..PPAn additional set of six icons can be provided for widgets that have an "On" or "Off" state, like checkable menu items or toggleable toolbuttons. If you provide pixmaps for the "On" state, but not for the "Off" state, the QIconSet will provide the "Off" pixmaps. You may specify icons for both states in you wish..PPYou can set any of the icons using setPixmap()..PPWhen you retrieve a pixmap using pixmap(Size, Mode, State), QIconSet will return the icon that has been set or previously generated for that size, mode and state combination. If none is available, QIconSet will ask the icon factory. If the icon factory cannot provide any (the default), QIconSet generates a pixmap based on the pixmaps it has been given and returns it..PPThe Disabled appearance is computed using an algorithm that produces results very similar to those used in Microsoft Windows 95. The Active appearance is identical to the Normal appearance unless you use setPixmap() to set it to something special..PPWhen scaling icons, QIconSet uses smooth scaling, which can partially blend the color component of pixmaps. If the results look poor, the best solution is to supply pixmaps in both large and small sizes..PPYou can use the static function setIconSize() to set the preferred size of the generated large/small icons. The default small size is 22 x 22, while the default large size is 32 x 32. These sizes only affect generated icons..PPThe isGenerated() function returns TRUE if an icon was generated by QIconSet or by a factory; clearGenerated() clears all cached pixmaps..SH "Making Classes that Use QIconSet"If you write your own widgets that have an option to set a small pixmap, consider allowing a QIconSet to be set for that pixmap. The Qt class QToolButton is an example of such a widget..PPProvide a method to set a QIconSet, and when you draw the icon, choose whichever icon is appropriate for the current state of your widget. For example:.PP.nf.br    void MyWidget::drawIcon( QPainter* p, QPoint pos ).br    {.br        p->drawPixmap( pos, icons->pixmap(QIconSet::Small, isEnabled()) );.br    }.br.fi.PPYou might also make use of the Active mode, perhaps making your widget Active when the mouse is over the widget (see QWidget::enterEvent()), 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 "On" mode might be used to draw a different icon..PP<center>.ce 1.B "[Image Omitted]".PP</center>.PPSee also QIconFactory, QPixmap, QMainWindow::usesBigPixmaps, GUI Design Handbook: Iconic Label, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes..SS "Member Type Documentation".SH "QIconSet::Mode"This enum type describes the mode for which a pixmap is intended to be used. The currently defined modes are:.TP\fCQIconSet::Normal\fR - Display the pixmap when the user is not interacting with the icon, but the functionality represented by the icon is available..TP\fCQIconSet::Disabled\fR - Display the pixmap when the functionality represented by the icon is not available..TP\fCQIconSet::Active\fR - 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..SH "QIconSet::Size"This enum type describes the size at which a pixmap is intended to be used. The currently defined sizes are:.TP\fCQIconSet::Automatic\fR - The size of the pixmap is determined from its pixel size. This is a useful default..TP\fCQIconSet::Small\fR - The pixmap is the smaller of two..TP\fCQIconSet::Large\fR - The pixmap is the larger of two..PPIf a Small pixmap is not set by QIconSet::setPixmap(), the Large pixmap will be automatically scaled down to the size of a small pixmap to generate the Small pixmap when required. Similarly, a Small pixmap will be automatically scaled up to generate a Large pixmap. The preferred sizes for large/small generated icons can be set using setIconSize()..PPSee also setIconSize(), iconSize(), setPixmap(), pixmap(), and QMainWindow::usesBigPixmaps..SH "QIconSet::State"This enum describes the state for which a pixmap is intended to be used. The \fIstate\fR can be:.TP\fCQIconSet::Off\fR - Display the pixmap when the widget is in an "off" state.TP\fCQIconSet::On\fR - Display the pixmap when the widget is in an "on" state.PPSee also setPixmap() and pixmap()..SH MEMBER FUNCTION DOCUMENTATION.SH "QIconSet::QIconSet ()"Constructs a null icon set..PPSee also setPixmap() and reset()..SH "QIconSet::QIconSet ( const QPixmap & pixmap, Size size = Automatic )"Constructs an icon set for which the Normal pixmap is \fIpixmap\fR, which is assumed to be of size \fIsize\fR..PPThe default for \fIsize\fR is Automatic, which means that QIconSet will determine whether the pixmap is Small or Large from its pixel size. Pixmaps less than the width of a small generated icon are considered to be Small. You can use setIconSize() to set the preferred size of a generated icon..PPSee also setIconSize() and reset()..SH "QIconSet::QIconSet ( const QPixmap & smallPix, const QPixmap & largePix )"Creates an iconset which uses the pixmap \fIsmallPix\fR for for displaying a small icon, and the pixmap \fIlargePix\fR for displaying a large icon..SH "QIconSet::QIconSet ( const QIconSet & other )"Constructs a copy of \fIother\fR. This is very fast..SH "QIconSet::~QIconSet ()\fC [virtual]\fR"Destroys the icon set and frees any allocated resources..SH "void QIconSet::clearGenerated ()"Clears all cached pixmaps, including those obtained from an eventual QIconFactory..SH "QPixmap * QIconSet::createDisabled ( Size size, State state ) const"Returns a new pixmap that has a 'disabled' look, taking as its base the iconset's icon with size \fIsize\fR and state \fIstate\fR..SH "QPixmap * QIconSet::createScaled ( Size size, const QPixmap * suppliedPix ) const"Returns a new pixmap that is a copy of \fIsuppliedPix\fR, scaled to the icon size \fIsize\fR..SH "void QIconSet::detach ()"Detaches this icon set from others with which it may share data..PPYou will never need to call this function; other QIconSet functions call it as necessary..SH "const QSize & QIconSet::iconSize ( Size which )\fC [static]\fR"If \fIwhich\fR is Small, returns the preferred size of a small generated icon; if \fIwhich\fR is Large, returns the preferred size of a large generated icon..PPSee also setIconSize()..SH "void QIconSet::installIconFactory ( QIconFactory * factory )"Installs \fIfactory\fR as the icon factory for this iconset. The icon factory is used to generates pixmaps not set by the user..PPIf no icon factory is installed, QIconFactory::defaultFactory() is used..SH "bool QIconSet::isGenerated ( Size size, Mode mode, State state = Off ) const"Returns TRUE if the pixmap with size \fIsize\fR, mode \fImode\fR and state \fIstate\fR is generated from other pixmaps; otherwise returns FALSE..PPA pixmap obtained from a QIconFactory is considered non-generated..SH "bool QIconSet::isNull () const"Returns TRUE if the icon set is empty; otherwise returns FALSE..SH "QIconSet & QIconSet::operator= ( const QIconSet & other )"Assigns \fIother\fR to this icon set and returns a reference to this icon set..PPSee also detach()..SH "QPixmap QIconSet::pixmap ( Size size, Mode mode, State state = Off ) const"Returns a pixmap with size \fIsize\fR, mode \fImode\fR and state \fIstate\fR, generating one if necessary. Generated pixmaps are cached..SH "QPixmap QIconSet::pixmap ( Size size, bool enabled, State state = Off ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PP\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPThis is the same as pixmap(\fIsize\fR, \fIenabled\fR, \fIstate\fR)..SH "QPixmap QIconSet::pixmap () const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the pixmap originally provided to the constructor or to reset(). This is the Normal pixmap of unspecified Size..PPSee also reset()..SH "void QIconSet::reset ( const QPixmap & pixmap, Size size )"Sets this icon set to use pixmap \fIpixmap\fR for the Normal pixmap, assuming it to be of size \fIsize\fR..PPThis is equivalent to assigning QIconSet(\fIpixmap\fR, \fIsize\fR) to this icon set..PPThis function does nothing if \fIpixmap\fR is a null pixmap..SH "void QIconSet::setIconSize ( Size which, const QSize & size )\fC [static]\fR"Set the preferred size for all small or large icons that are generated after this call. If \fIwhich\fR is Small, sets the preferred size of small generated icons to \fIsize\fR. Similarly, if \fIwhich\fR is Large, sets the preferred size of large generated icons to \fIsize\fR..PPNote that cached icons will not be regenerated, so it is recommended that you set the preferred icon sizes before generating any icon sets. Also note that the preferred icon sizes will be ignored for icon sets that have been created using both small and large pixmaps..PPSee also iconSize()..SH "void QIconSet::setPixmap ( const QPixmap & pixmap, Size size, Mode mode = Normal, State state = Off )\fC [virtual]\fR"Sets this icon set to provide pixmap \fIpixmap\fR for size \fIsize\fR, mode \fImode\fR and state \fIstate\fR. The icon set may also use \fIpixmap\fR for generating other pixmaps if they are not explicitly set..PPThe \fIsize\fR can be one of Automatic, Large or Small. If Automatic is used, QIconSet will determine if the pixmap is Small or Large from its pixel size..PPPixmaps less than the width of a small generated icon are considered to be Small. You can use setIconSize() to set the preferred size of a generated icon..PPThis function does nothing if \fIpixmap\fR is a null pixmap..PPSee also reset()..SH "void QIconSet::setPixmap ( const QString & fileName, Size size, Mode mode = Normal, State state = Off )\fC [virtual]\fR"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThe pixmap is loaded from \fIfileName\fR when it becomes necessary..SH "SEE ALSO".BR http://doc.trolltech.com/qiconset.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qiconset.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

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