'\" t .TH TQIconSet 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. .\" .ad l .nh .SH NAME TQIconSet \- Set of icons with different styles and sizes .SH SYNOPSIS \fC#include \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 "\fBTQIconSet\fR ()" .br .ti -1c .BI "\fBTQIconSet\fR ( const TQPixmap & pixmap, Size size = Automatic )" .br .ti -1c .BI "\fBTQIconSet\fR ( const TQPixmap & smallPix, const TQPixmap & largePix )" .br .ti -1c .BI "\fBTQIconSet\fR ( const TQIconSet & other )" .br .ti -1c .BI "virtual \fB~TQIconSet\fR ()" .br .ti -1c .BI "void \fBreset\fR ( const TQPixmap & pixmap, Size size )" .br .ti -1c .BI "virtual void \fBsetPixmap\fR ( const TQPixmap & pixmap, Size size, Mode mode = Normal, State state = Off )" .br .ti -1c .BI "virtual void \fBsetPixmap\fR ( const TQString & fileName, Size size, Mode mode = Normal, State state = Off )" .br .ti -1c .BI "TQPixmap \fBpixmap\fR ( Size size, Mode mode, State state = Off ) const" .br .ti -1c .BI "TQPixmap pixmap ( Size size, bool enabled, State state = Off ) const \fI(obsolete)\fR" .br .ti -1c .BI "TQPixmap \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 ( TQIconFactory * factory )" .br .ti -1c .BI "bool \fBisNull\fR () const" .br .ti -1c .BI "void \fBdetach\fR ()" .br .ti -1c .BI "TQIconSet & \fBoperator=\fR ( const TQIconSet & other )" .br .in -1c .SS "Static Public Members" .in +1c .ti -1c .BI "void \fBsetIconSize\fR ( Size which, const TQSize & size )" .br .ti -1c .BI "const TQSize & \fBiconSize\fR ( Size which )" .br .in -1c .SH DESCRIPTION The TQIconSet class provides a set of icons with different styles and sizes. .PP A TQIconSet can generate smaller, larger, active, and disabled pixmaps from the set of icons it is given. Such pixmaps are used by TQToolButton, QHeader, TQPopupMenu, etc. to show an icon representing a particular action. .PP The simplest use of TQIconSet is to create one from a TQPixmap and then use it, allowing TQt to work out all the required icon styles and sizes. For example: .PP .nf .br TQToolButton *but = new TQToolButton( TQIconSet( TQPixmap("open.xpm") ), ... ); .br .fi .PP Using whichever pixmaps you specify as a base, TQIconSet 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. .PP An 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 TQIconSet will provide the "Off" pixmaps. You may specify icons for both states in you wish. .PP You can set any of the icons using setPixmap(). .PP When you retrieve a pixmap using pixmap(Size, Mode, State), TQIconSet will return the icon that has been set or previously generated for that size, mode and state combination. If none is available, TQIconSet will ask the icon factory. If the icon factory cannot provide any (the default), TQIconSet generates a pixmap based on the pixmaps it has been given and returns it. .PP The 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. .PP When scaling icons, TQIconSet 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. .PP You 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. .PP The isGenerated() function returns TRUE if an icon was generated by TQIconSet or by a factory; clearGenerated() clears all cached pixmaps. .SH "Making Classes that Use TQIconSet" If you write your own widgets that have an option to set a small pixmap, consider allowing a TQIconSet to be set for that pixmap. The TQt class TQToolButton is an example of such a widget. .PP Provide a method to set a TQIconSet, 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( TQPainter* p, TQPoint pos ) .br { .br p->drawPixmap( pos, icons->pixmap( .br TQIconSet::Small, .br isEnabled() ? TQIconSet::Normal : .br TQIconSet::Disabled, .br isEnabled() ? TQIconSet::On : .br TQIconSet::Off)); .br } .br .fi .PP You might also make use of the Active mode, perhaps making your widget Active when the mouse is over the widget (see TQWidget::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
.ce 1 .B "[Image Omitted]" .PP
.PP See also TQIconFactory, TQPixmap, TQMainWindow::usesBigPixmaps, GUI Design Handbook: Iconic Label, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. .SS "Member Type Documentation" .SH "TQIconSet::Mode" This enum type describes the mode for which a pixmap is intended to be used. The currently defined modes are: .TP \fCTQIconSet::Normal\fR - Display the pixmap when the user is not interacting with the icon, but the functionality represented by the icon is available. .TP \fCTQIconSet::Disabled\fR - Display the pixmap when the functionality represented by the icon is not available. .TP \fCTQIconSet::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 "TQIconSet::Size" This enum type describes the size at which a pixmap is intended to be used. The currently defined sizes are: .TP \fCTQIconSet::Automatic\fR - The size of the pixmap is determined from its pixel size. This is a useful default. .TP \fCTQIconSet::Small\fR - The pixmap is the smaller of two. .TP \fCTQIconSet::Large\fR - The pixmap is the larger of two. .PP If a Small pixmap is not set by TQIconSet::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(). .PP See also setIconSize(), iconSize(), setPixmap(), pixmap(), and TQMainWindow::usesBigPixmaps. .SH "TQIconSet::State" This enum describes the state for which a pixmap is intended to be used. The \fIstate\fR can be: .TP \fCTQIconSet::Off\fR - Display the pixmap when the widget is in an "off" state .TP \fCTQIconSet::On\fR - Display the pixmap when the widget is in an "on" state .PP See also setPixmap() and pixmap(). .SH MEMBER FUNCTION DOCUMENTATION .SH "TQIconSet::TQIconSet ()" Constructs a null icon set. .PP See also setPixmap() and reset(). .SH "TQIconSet::TQIconSet ( const TQPixmap & 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. .PP The default for \fIsize\fR is Automatic, which means that TQIconSet 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. .PP See also setIconSize() and reset(). .SH "TQIconSet::TQIconSet ( const TQPixmap & smallPix, const TQPixmap & 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 "TQIconSet::TQIconSet ( const TQIconSet & other )" Constructs a copy of \fIother\fR. This is very fast. .SH "TQIconSet::~TQIconSet ()\fC [virtual]\fR" Destroys the icon set and frees any allocated resources. .SH "void TQIconSet::clearGenerated ()" Clears all cached pixmaps, including those obtained from an eventual TQIconFactory. .SH "void TQIconSet::detach ()" Detaches this icon set from others with which it may share data. .PP You will never need to call this function; other TQIconSet functions call it as necessary. .SH "const TQSize & TQIconSet::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. .PP See also setIconSize(). .SH "void TQIconSet::installIconFactory ( TQIconFactory * factory )" Installs \fIfactory\fR as the icon factory for this iconset. The icon factory is used to generates pixmaps not set by the user. .PP If no icon factory is installed, TQIconFactory::defaultFactory() is used. .SH "bool TQIconSet::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. .PP A pixmap obtained from a TQIconFactory is considered non-generated. .SH "bool TQIconSet::isNull () const" Returns TRUE if the icon set is empty; otherwise returns FALSE. .SH "TQIconSet & TQIconSet::operator= ( const TQIconSet & other )" Assigns \fIother\fR to this icon set and returns a reference to this icon set. .PP See also detach(). .SH "TQPixmap TQIconSet::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 "TQPixmap TQIconSet::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. .PP This is the same as pixmap(\fIsize\fR, \fIenabled\fR, \fIstate\fR). .SH "TQPixmap TQIconSet::pixmap () const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the pixmap originally provided to the constructor or to reset(). This is the Normal pixmap of unspecified Size. .PP See also reset(). .SH "void TQIconSet::reset ( const TQPixmap & pixmap, Size size )" Sets this icon set to use pixmap \fIpixmap\fR for the Normal pixmap, assuming it to be of size \fIsize\fR. .PP This is equivalent to assigning TQIconSet(\fIpixmap\fR, \fIsize\fR) to this icon set. .PP This function does nothing if \fIpixmap\fR is a null pixmap. .SH "void TQIconSet::setIconSize ( Size which, const TQSize & 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. .PP Note 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. .PP See also iconSize(). .SH "void TQIconSet::setPixmap ( const TQPixmap & 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. .PP The \fIsize\fR can be one of Automatic, Large or Small. If Automatic is used, TQIconSet will determine if the pixmap is Small or Large from its pixel size. .PP 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. .PP This function does nothing if \fIpixmap\fR is a null pixmap. .PP See also reset(). .SH "void TQIconSet::setPixmap ( const TQString & 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. .PP The pixmap is loaded from \fIfileName\fR when it becomes necessary. .SH "SEE ALSO" .BR http://doc.trolltech.com/tqiconset.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. .SH AUTHOR Generated automatically from the source code. .SH BUGS If 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. .P The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. .P If you find errors in this manual page, please report them to .BR qt-bugs@trolltech.com . Please include the name of the manual page (tqiconset.3qt) and the Qt version (3.3.8).