Compatibility Members for QPixmap

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

Public Types

enum ColorMode { Auto, Color, Mono }

Public Functions

QPixmap(const QString & fileName, const char * format, ColorMode mode)
QPixmap(const QImage & image)
bool convertFromImage(const QImage & image, ColorMode mode)
QImage convertToImage() const
bool load(const QString & fileName, const char * format, ColorMode mode)
bool loadFromData(const uchar * buf, uint len, const char * format, ColorMode mode)
void resize(int width, int height)
void resize(const QSize & size)
bool selfMask() const
QPixmap xForm(const QMatrix & matrix) const
operator QImage() const
QPixmap & operator=(const QImage & image)

Member Type Documentation

enum QPixmap::ColorMode

This enum type defines the color modes that exist for converting QImage objects to QPixmap. It is provided here for compatibility with earlier versions of Qt.

Use Qt::ImageConversionFlags instead.

ConstantValueDescription
QPixmap::Auto0Select Color or Mono on a case-by-case basis.
QPixmap::Color1Always create colored pixmaps.
QPixmap::Mono2Always create bitmaps.

Member Function Documentation

QPixmap::QPixmap(const QString & fileName, const char * format, ColorMode mode)

Use the constructor that takes a Qt::ImageConversionFlag instead.

QPixmap::QPixmap(const QImage & image)

Constructs a pixmap from the QImage image.

Use the static fromImage() function instead.

bool QPixmap::convertFromImage(const QImage & image, ColorMode mode)

Use the static fromImage() function instead.

QImage QPixmap::convertToImage() const

Use the toImage() function instead.

bool QPixmap::load(const QString & fileName, const char * format, ColorMode mode)

Use the load() function that takes a Qt::ImageConversionFlag instead.

bool QPixmap::loadFromData(const uchar * buf, uint len, const char * format, ColorMode mode)

Use the loadFromData() function that takes a Qt::ImageConversionFlag instead.

void QPixmap::resize(int width, int height)

Use QPixmap::copy() instead to get the pixmap with the new size.

For example, if you have code like

pixmap.resize(10, 20);

you can rewrite it as

pixmap = pixmap.copy(0, 0, 10, 20);

void QPixmap::resize(const QSize & size)

This is an overloaded function.

Use QPixmap::copy() instead to get the pixmap with the new size.

For example, if you have code like

pixmap.resize(size);

you can rewrite it as

pixmap = pixmap.copy(QRect(QPoint(0, 0), size));

bool QPixmap::selfMask() const

Returns whether the pixmap is its own mask or not.

This function is no longer relevant since the concept of self masking doesn't exists anymore.

QPixmap QPixmap::xForm(const QMatrix & matrix) const

Use transformed() instead.

QPixmap::operator QImage() const

Returns the pixmap as a QImage.

Use the toImage() function instead.

QPixmap & QPixmap::operator=(const QImage & image)

This is an overloaded function.

Converts the given image to a pixmap that is assigned to this pixmap.

Use the static fromImage() function instead.

© 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.