- Qt 6.4
- Qt GUI
- C++ Classes
- QIcon
- Qt 6.4.2 Reference Documentation

# Obsolete Members for QIcon

The following members of class QIcon are deprecated. They are provided to keep old source code working. We strongly advise against using them in new code.

## Public Functions

`(deprecated (6.0))` QSize | actualSize(QWindow *window, const QSize &size, QIcon::Mode mode = Normal, QIcon::State state = Off) const
`(deprecated (6.0))` QPixmap | pixmap(QWindow *window, const QSize &size, QIcon::Mode mode = Normal, QIcon::State state = Off) const

## Member Function Documentation

### `[since 5.1]` QSize QIcon::actualSize(QWindow *window, const QSize &size, QIcon::Mode mode = Normal, QIcon::State state = Off) const

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use actualSize(size) instead.

Returns the actual size of the icon for the requested window size, mode, and state.

The pixmap can be smaller than the requested size. The returned size is in device-independent pixels (This is relevant for high-dpi pixmaps.)

This function was introduced in Qt 5.1.

See also actualSize(), pixmap(), and paint().

### `[since 5.1]` QPixmap QIcon::pixmap(QWindow *window, const QSize &size, QIcon::Mode mode = Normal, QIcon::State state = Off) const

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use pixmap(size, devicePixelRatio) instead.

Returns a pixmap with the requested window size, mode, and state, generating one if necessary.

The pixmap can be smaller than the requested size. If window is on a high-dpi display the pixmap can be larger. In that case it will have a devicePixelRatio larger than 1.

This function was introduced in Qt 5.1.

See also actualSize() and paint().