Qt:Документация 4.3.2/qimageioplugin

Материал из Wiki.crossplatform.ru

Версия от 14:18, 12 января 2009; Root (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
40px Внимание: Актуальная версия перевода документации находится здесь

__NOTOC__

Image:qt-logo.png

Главная · Все классы · Основные классы · Классы по группам · Модули · Функции

Image:trolltech-logo.png

Содержание

QImageIOPlugin Class Reference
[модуль QtGui ]

The QImageIOPlugin class defines an interface for writing an image format plugin. Далее...

 #include <QImageIOPlugin>

Inherits QObject.

Открытые типы

Открытые функции

  • QImageIOPlugin ( QObject * parent = 0 )
  • virtual ~QImageIOPlugin ()
  • virtual Capabilities capabilities ( QIODevice * device, const QByteArray & format ) const = 0
  • virtual QImageIOHandler * create ( QIODevice * device, const QByteArray & format = QByteArray() ) const = 0
  • virtual QStringList keys () const = 0
  • 29 открытых функций, унаследованных от QObject

Дополнительные унаследованные члены

  • 1 свойство, унаследованное от QObject
  • 1 открытый слот, унаследованный от QObject
  • 1 сигнал, унаследованный от QObject
  • 5 статических открытых членов, унаследованных от QObject
  • 7 защищенных функций, унаследованных от QObject

Подробное описание

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.

Writing an image I/O plugin is achieved by subclassing this base class, reimplementing the pure virtual functions capabilities(), create(), and keys(), and exporting the class with the Q_EXPORT_PLUGIN2() macro. See How to Create Qt Plugins for details.

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 and How to Create Qt Plugins.


Описание типов

enum QImageIOPlugin::Capability
flags QImageIOPlugin::Capabilities

This enum describes the capabilities of a QImageIOPlugin.


Константа Значение Описание
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 is a typedef for QFlags<Capability>. It stores an OR combination of Capability values.


Описание функций-членов

QImageIOPlugin::QImageIOPlugin ( QObject * parent = 0 )

Constructs an image plugin with the given parent. This is invoked automatically by the Q_EXPORT_PLUGIN2() macro.

QImageIOPlugin::~QImageIOPlugin () [virtual]

Destroys the picture format plugin.

You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used.

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.

QImageIOHandler * QImageIOPlugin::create ( QIODevice * device, const QByteArray & format = QByteArray() ) const [pure virtual]

Creates and returns a QImageIOHandler subclass, with device and format set. The format must come from the list returned by keys(). Format names are case sensitive.

See also keys().

QStringList QImageIOPlugin::keys () const [pure virtual]

Returns the list of image keys this plugin supports.

These keys are usually the names of the image formats that are implemented in the plugin (e.g., "jpg" or "gif").

See also capabilities().



Copyright © 2007 Trolltech Trademarks
Qt 4.3.2