A QIcon is a class from the Qt toolkit which provides scalable icons in different modes and states.
A QIcon can generate "small", "large", "active", and "disabled" pixmaps from the set of pixmaps it is given. Such pixmaps are used by Qt widgets to show an icon representing a particular action.
The simplest use of QIcon is to create one from a QPixmap file or resource, and allow Qt to work out all the required icon styles and sizes.
If a pixmap is requested, and no pixmap for that given size, mode and state is available, QIcon will generate one on the fly. This pixmap generation happens in a QIconEngineV2. The default engine scales pixmaps down if required, but never up, and it uses the current style to calculate a disabled appearance.
By using custom icon engines, you can customize every aspect of generated icons. With QIconEnginePluginV2 it is possible to register different icon engines for different file suffixes, making it possible for third parties to provide additional icon engines to those included with Qt.
Since Qt 4.2, an icon engine that supports SVG is also included.
Simple example which describes how QIcon can be used:
QToolButton *button = new QToolButton;
button->setIcon(QIcon("open.xpm"));
The official Qt documentation can be found here.