Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions |

# Compatibility Members for QPixmap

The following class members are part of the Qt 3 compatibility layer. They are provided to help you port old code to Qt 4. We strongly advise against using them in new code.

QPixmap class reference

### Public Types

- enum ColorMode { Auto, Color, Mono }

### Public Functions

- QPixmap ( const QString & fileName, const char * format, ColorMode mode )
- bool convertFromImage ( const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor )
- 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 )
- QPixmap xForm ( const QMatrix & matrix ) const

## Member Type Documentation

### enum QPixmap::ColorMode

This enum type defines the color modes that exist for converting QImage objects to QPixmap.

`QPixmap::Auto` | Select `Color` or `Mono` on a case-by-case basis.
`QPixmap::Color` | Always create colored pixmaps.
`QPixmap::Mono` | Always create bitmaps.

## Member Function Documentation

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

Constructs a pixmap from the file fileName. If the file does not exist or is of an unknown format, the pixmap becomes a null pixmap.

The fileName, format and mode parameters are passed on to load(). This means that the data in fileName is not compiled into the binary. If fileName contains a relative path (e.g. the filename only) the relevant file must be found relative to the runtime working directory.

See also QPixmap::ColorMode, isNull(), load(), loadFromData(), save(), and imageFormat().

### bool QPixmap::convertFromImage ( const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor )

Creates a pixmap from the given image using the conversion flags specified by flags.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Creates a pixmap from the given image with the color mode specified by mode.

### QImage QPixmap::convertToImage () const

Converts the pixmap to a device-independent image and returns the result as a new image.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Loads a pixmap from the file fileName at runtime.

If format is specified, the loader attempts to read the pixmap using the specified format. If format is not specified (default), the loader reads a few bytes from the header to guess the file's format.

The mode is used to specify the color mode of the pixmap.

See also QPixmap::ColorMode.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Loads a pixmap from the binary data in buf (len bytes) using color mode mode. Returns true if successful; otherwise returns false.

If format is specified, the loader attempts to read the pixmap using the specified format. If format is not specified (default), the loader reads a few bytes from the header to guess the file's format.

See also QPixmap::ColorMode.

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

Transforms the pixmap using the given matrix and returns the result as a new pixmap.