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

# QImageIOPlugin Class Reference

The QImageIOPlugin class defines an interface for writing an image format plugin. More...

    #include <QImageIOPlugin>

Part of the QtGui module.

Inherits QObject and QImageIOHandlerFactoryInterface.

- List of all members, including inherited members

### Public Types

- flags Capabilities
- enum Capability { CanRead, CanWrite, CanReadIncremental }

### Public Functions

- QImageIOPlugin ( QObject * parent = 0 )
- virtual ~QImageIOPlugin ()
- virtual Capabilities capabilities ( QIODevice * device, const QByteArray & format ) const = 0

- 28 public functions inherited from QObject
- 1 public function inherited from QImageIOHandlerFactoryInterface

### Additional Inherited Members

- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 1 signal inherited from QObject
- 4 static public members inherited from QObject
- 7 protected functions inherited from QObject

## Detailed Description

The QImageIOPlugin class defines an interface for writing an image format plugin.

QImageIOPlugin is a factory for creating QImageIOHandler objects, which are used internally by QImageReader and QImageWriter to add support for different image formats to Qt.

An image format plugin can support three capabilities: reading (CanRead), writing (CanWrite) and incremental reading (CanReadIncremental). Reimplement capabilities() in you subclass to expose the capabilities of your image format.

create() should create an instance of your QImageIOHandler subclass, with the provided device and format properly set, and return this handler. You must also reimplement keys() so that Qt knows which image formats your plugin supports.

Different plugins can support different capabilities. For example, you may have one plugin that supports reading the GIF format, and another that supports writing. Qt will select the correct plugin for the job, depending on the return value of capabilities(). If several plugins support the same capability, Qt will select one arbitrarily.

See also QImageIOHandler.

## Member Type Documentation

### enum QImageIOPlugin::Capability
flags QImageIOPlugin::Capabilities

This enum describes the capabilities of a QImageIOPlugin.

Constant | Value | Description
--- | --- | ---
`QImageIOPlugin::CanRead` | `0x1` | The plugin can read images.
`QImageIOPlugin::CanWrite` | `0x2` | The plugin can write images.
`QImageIOPlugin::CanReadIncremental` | `0x4` | The plugin can read images incrementally.

The `Capabilities` type stores an OR combination of `Capability` values.

## Member Function Documentation

### QImageIOPlugin::QImageIOPlugin ( QObject * parent = 0 )

Constructs a QImageIOPlugin object. The parent argument is passed to QObject's constructor.

### QImageIOPlugin::~QImageIOPlugin () `[virtual]`

Destructs the QImageIOPlugin object.

### Capabilities QImageIOPlugin::capabilities ( QIODevice * device, const QByteArray & format ) const `[pure virtual]`

Returns the capabilities on the plugin, based on the data in device and the format format. For example, if the QImageIOHandler supports the BMP format, and the data in the device starts with the characters "BM", this function should return CanRead. If format is "bmp" and the handler supports both reading and writing, this function should return CanRead | CanWrite.