# QIconSet Class Reference

The QIconSet class provides a set of icons (normal, disabled, various sizes) for e.g. buttons. More...

`#include <qiconset.h>`

List of all member functions.

## Public Members

- QIconSet ( const QPixmap &, Size = Automatic )
- QIconSet ( const QIconSet & )
- virtual ~QIconSet ()
- void reset ( const QPixmap &, Size )
- void setPixmap ( const QPixmap &, Size, Mode = Normal )
- void setPixmap ( const char *, Size, Mode = Normal )
- QPixmap pixmap ( Size, Mode ) const
- QPixmap pixmap () const
- bool isGenerated ( Size, Mode ) const
- void detach ()
- QIconSet& operator= ( const QIconSet & )

## Detailed Description

The QIconSet class provides a set of icons (normal, disabled, various sizes) for e.g. buttons.

QIconSet must be fed at least one icon, and can generate the other icons from the ones it is fed, or use programmer-specified icons.

Using the icon or icons specified, QIconSet generates a set of six icons:

- Small, normal
- Small, disabled
- Small, active
- Large, normal
- Large, disabled
- Large, active

You can set any of the icons using setPixmap() and when you retrieve one using pixmap(), QIconSet will compute and cache that from the closest other icon.

The `Disabled` appearance is computed using a "shadow" algorithm which produces results very similar to that used in of Microsoft Windows 95.

The `Active` appearance is identical to the `Normal` appearance unless you use setPixmap() to set it to something special.

QIconSet provides a function, isGenerated(), that indicates whether an icon was set by the application programmer or computed by QIconSet itself.

In Qt 1.41 only QToolButton uses QIconSet. In Qt 2.0 we will use it in more classes, including the menu system.

See also: QPixmap, QLabel, QToolButton, GUI Design Handbook: Iconic Label,, Microsoft, Icon and Gallery.

## Member Function Documentation

### QIconSet::QIconSet ( const QPixmap & defaultPixmap, Size defaultSize = Automatic )

Constructs an icon set that will generate its members from defaultPixmap, which is assumed to be of defaultSize.

The default for defaultSize is `Automatic,` which means that QIconSet will determine the icon's size from its actual size.

See also: reset().

### QIconSet::QIconSet ( const QIconSet & other )

Constructs an a copy of other. This is very fast.

See also: detach().

### QIconSet::~QIconSet () `[virtual]`

Destroys the icon set and frees any allocated resources.

### void QIconSet::detach ()

Detaches this icon set from others with which it may share data. You should never need to call this function; reset() and setPixmap() call it as necessary. It exists merely so that the copy constructor and operator= can be faster.

### bool QIconSet::isGenerated ( Size s, Mode m ) const

Returns TRUE if the variant with size s and mode m was automatically generated, and FALSE if it was not.

### QIconSet & QIconSet::operator= ( const QIconSet & p )

Assigns other to this icon set and returns a reference to this icon set.

This is very fast.

See also: detach().

### QPixmap QIconSet::pixmap () const

Returns the pixmap originally provided to the constructor or reset().

See also: reset().

### QPixmap QIconSet::pixmap ( Size s, Mode m ) const

Returns a pixmap with size s and mode m, generating one if needed.

### void QIconSet::reset ( const QPixmap & pm, Size s )

Set this icon set to display pm, which is assumed to be in size s. If s is `Automatic,` QIconSet guesses the size from the size of pm using and unspecified algorithm.

### void QIconSet::setPixmap ( const QPixmap & pm, Size s, Mode m = Normal )

Sets this icon set to display pn in size s/mode m, and perhaps to use pm for deriving some other varieties.

s must be Large or Small; it cannot be Automatic.

### void QIconSet::setPixmap ( const char * fileName, Size s, Mode m = Normal )

Sets this icon set to load fileName as a pixmap and display it in size s/mode m, and perhaps to use pm for deriving some other varieties.

Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):

This file is part of the Qt toolkit, copyright © 1995-99 Troll Tech, all rights reserved.

It was generated from the following files:

- qiconset.h: 1998/10/21
- qiconset.cpp: 1999/02/01