Qt logo

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


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:

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.

When scaling icons, QIconSet uses smooth scaling, which can partially blend the color component of transparent images. If the results look poor, the best solution is to supply sizes that do not require scaling.

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

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


Member Function Documentation

QIconSet::QIconSet(constQPixmap&defaultPixmap, SizedefaultSize=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(constQIconSet&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.

voidQIconSet::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.

boolQIconSet::isGenerated(Sizes, Modem)const

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

QIconSet&QIconSet::operator=(constQIconSet&p)

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

This is very fast.

See also: detach().

QPixmapQIconSet::pixmap()const

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

See also: reset().

QPixmapQIconSet::pixmap(Sizes, Modem)const

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

voidQIconSet::reset(constQPixmap&pm, Sizes)

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 an unspecified algorithm.

voidQIconSet::setPixmap(constQPixmap&pm, Sizes, Modem=Normal) [virtual]

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.

voidQIconSet::setPixmap(constQString&fileName, Sizes, Modem=Normal) [virtual]

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.


Copyright 1999 Troll TechTrademarks
Qt version 2.0.2