Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QImageIOPlugin Class

TheQImageIOPlugin class defines an interface for writing an image format plugin.More...

Header:#include <QImageIOPlugin>
Inherits:QObject

Note: All functions in this class arereentrant.

Public Types

flagsCapabilities
enumCapability { CanRead, CanWrite, CanReadIncremental }

Public Functions

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

Reimplemented Public Functions

virtual QImageIOHandler *create(QIODevice * device, const QByteArray & format = QByteArray()) const = 0
virtual QStringListkeys() const = 0
  • 29 public functions inherited fromQObject

Additional Inherited Members

  • 1 property inherited fromQObject
  • 1 public slot inherited fromQObject
  • 1 signal inherited fromQObject
  • 7 static public members inherited fromQObject
  • 8 protected functions inherited fromQObject

Detailed Description

TheQImageIOPlugin class defines an interface for writing an image format plugin.

QImageIOPlugin is a factory for creatingQImageIOHandler objects, which are used internally byQImageReader andQImageWriter 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 functionscapabilities(),create(), andkeys(), and exporting the class with theQ_EXPORT_PLUGIN2() macro. SeeHow to Create Qt Plugins for details.

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

create() should create an instance of yourQImageIOHandler subclass, with the provided device and format properly set, and return this handler. You must also reimplementkeys() 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 ofcapabilities(). If several plugins support the same capability, Qt will select one arbitrarily.

See alsoQImageIOHandler andHow to Create Qt Plugins.

Member Type Documentation

enum QImageIOPlugin::Capability
flags QImageIOPlugin::Capabilities

This enum describes the capabilities of aQImageIOPlugin.

ConstantValueDescription
QImageIOPlugin::CanRead0x1The plugin can read images.
QImageIOPlugin::CanWrite0x2The plugin can write images.
QImageIOPlugin::CanReadIncremental0x4The plugin can read images incrementally.

The Capabilities type is a typedef forQFlags<Capability>. It stores an OR combination of Capability values.

Member Function Documentation

QImageIOPlugin::QImageIOPlugin(QObject * parent = 0)

Constructs an image plugin with the givenparent. This is invoked automatically by theQ_EXPORT_PLUGIN2() macro.

[virtual]QImageIOPlugin::~QImageIOPlugin()

Destroys the picture format plugin.

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

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

Returns the capabilities on the plugin, based on the data indevice and the formatformat. For example, if theQImageIOHandler supports the BMP format, and the data in the device starts with the characters "BM", this function should returnCanRead. Ifformat is "bmp" and the handler supports both reading and writing, this function should returnCanRead |CanWrite.

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

Creates and returns aQImageIOHandler subclass, withdevice andformat set. Theformat must come from the list returned bykeys(). Format names are case sensitive.

See alsokeys().

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

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 alsocapabilities().

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


[8]ページ先頭

©2009-2025 Movatter.jp