Compatibility Members for QIcon

The following members of class QIconare part of the Qt compatibility layer. We advise against using them in new code.

Public Types

enum Size { Small, Large, Automatic }

Public Functions

QPixmap pixmap(Size size, Mode mode, State state = Off) const
QPixmap pixmap(Size size, bool enabled, State state = Off) const
QPixmap pixmap() const
void reset(const QPixmap & pixmap, Size size)
void setPixmap(const QPixmap & pixmap, Size size, Mode mode = Normal, State state = Off)
void setPixmap(const QString & fileName, Size size, Mode mode = Normal, State state = Off)

Static Public Members

QSize pixmapSize(Size which)
void setPixmapSize(Size which, const QSize & size)

Member Type Documentation

enum QIcon::Size

ConstantValueDescription
QIcon::Small0Use QStyle::pixelMetric(QStyle::PM_SmallIconSize) instead.
QIcon::Large1Use QStyle::pixelMetric(QStyle::PM_LargeIconSize) instead.
QIcon::AutomaticSmallN/A.

Member Function Documentation

QPixmap QIcon::pixmap(Size size, Mode mode, State state = Off) const

Use pixmap(QSize(...), mode, state), where the first argument is an appropriate QSize instead of a Size value.

See also pixmapSize().

QPixmap QIcon::pixmap(Size size, bool enabled, State state = Off) const

Use pixmap(QSize(...), mode, state), where the first argument is an appropriate QSize instead of a Size value, and the second argument is QIcon::Normal or QIcon::Disabled, depending on the value of enabled.

See also pixmapSize().

QPixmap QIcon::pixmap() const

Use one of the other pixmap() overloads.

[static] QSize QIcon::pixmapSize(Size which)

Use QStyle::pixelMetric() with QStyle::PM_SmallIconSize or QStyle::PM_LargeIconSize as the first argument, depending on which.

See also setPixmapSize().

void QIcon::reset(const QPixmap & pixmap, Size size)

Use the constructor that takes a QPixmap and operator=().

void QIcon::setPixmap(const QPixmap & pixmap, Size size, Mode mode = Normal, State state = Off)

Use addPixmap(pixmap, mode, state) instead. The size parameter is ignored.

See also pixmap().

void QIcon::setPixmap(const QString & fileName, Size size, Mode mode = Normal, State state = Off)

Use addFile(fileName, mode, state) instead. The size parameter is ignored.

[static] void QIcon::setPixmapSize(Size which, const QSize & size)

The pixmap() function now takes a QSize instead of a QIcon::Size, so there is no need for this function in new code.

See also pixmapSize().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.