Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QSvgIOHandler Class Reference

#include <qsvgiohandler.h>

Inheritance diagram for QSvgIOHandler:
Collaboration diagram for QSvgIOHandler:

Public Member Functions

 QSvgIOHandler ()
 ~QSvgIOHandler ()
bool canRead () const override
 Returns true if an image can be read from the device (i.e., the image format is supported, the device can be read from and the initial header information suggests that the image can be read); otherwise returns false.
bool read (QImage *image) override
 Read an image from the device, and stores it in image.
QVariant option (ImageOption option) const override
 Returns the value assigned to option as a QVariant.
void setOption (ImageOption option, const QVariant &value) override
 Sets the option option with the value value.
bool supportsOption (ImageOption option) const override
 Returns true if the QImageIOHandler supports the option option; otherwise returns false.
bool jumpToNextImage () override
 For image formats that support animation, this function jumps to the next image.
bool jumpToImage (int imageNumber) override
 For image formats that support animation, this function jumps to the image whose sequence number is imageNumber.
int loopCount () const override
 For image formats that support animation, this function returns the number of times the animation should loop.
int imageCount () const override
 For image formats that support animation, this function returns the number of images in the animation.
int nextImageDelay () const override
 For image formats that support animation, this function returns the number of milliseconds to wait until reading the next image.
int currentImageNumber () const override
 For image formats that support animation, this function returns the sequence number of the current image in the animation.
Public Member Functions inherited from QImageIOHandler
 QImageIOHandler ()
 Constructs a QImageIOHandler object.
virtual ~QImageIOHandler ()
 Destructs the QImageIOHandler object.
void setDevice (QIODevice *device)
 Sets the device of the QImageIOHandler to device.
QIODevicedevice () const
 Returns the device currently assigned to the QImageIOHandler.
void setFormat (const QByteArray &format)
 Sets the format of the QImageIOHandler to format.
void setFormat (const QByteArray &format) const
 Sets the format of the QImageIOHandler to format.
QByteArray format () const
 Returns the format that is currently assigned to QImageIOHandler.
virtual bool write (const QImage &image)
 Writes the image image to the assigned device.
virtual QRect currentImageRect () const
 Returns the rect of the current image.

Static Public Member Functions

static bool canRead (QIODevice *device)
Static Public Member Functions inherited from QImageIOHandler
static bool allocateImage (QSize size, QImage::Format format, QImage *image)

Additional Inherited Members

Public Types inherited from QImageIOHandler
enum  ImageOption {
  Size , ClipRect , Description , ScaledClipRect ,
  ScaledSize , CompressionRatio , Gamma , Quality ,
  Name , SubType , IncrementalReading , Endianness ,
  Animation , BackgroundColor , ImageFormat , SupportedSubTypes ,
  OptimizedWrite , ProgressiveScanWrite , ImageTransformation
}
 This enum describes the different options supported by QImageIOHandler. More...
enum  Transformation {
  TransformationNone = 0 , TransformationMirror = 1 , TransformationFlip = 2 , TransformationRotate180 = TransformationMirror | TransformationFlip ,
  TransformationRotate90 = 4 , TransformationMirrorAndRotate90 = TransformationMirror | TransformationRotate90 , TransformationFlipAndRotate90 = TransformationFlip | TransformationRotate90 , TransformationRotate270 = TransformationRotate180 | TransformationRotate90
}
Protected Member Functions inherited from QImageIOHandler
 QImageIOHandler (QImageIOHandlerPrivate &dd)
Protected Attributes inherited from QImageIOHandler
QScopedPointer< QImageIOHandlerPrivated_ptr

Detailed Description

Definition at line 21 of file qsvgiohandler.h.

Constructor & Destructor Documentation

◆ QSvgIOHandler()

QSvgIOHandler::QSvgIOHandler ( )

Definition at line 88 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::QSvgIOHandlerPrivate().

Referenced by QSvgPlugin::create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~QSvgIOHandler()

QSvgIOHandler::~QSvgIOHandler ( )

Definition at line 95 of file qsvgiohandler.cpp.

Member Function Documentation

◆ canRead() [1/2]

bool QSvgIOHandler::canRead ( ) const
overridevirtual

Returns true if an image can be read from the device (i.e., the image format is supported, the device can be read from and the initial header information suggests that the image can be read); otherwise returns false.

When reimplementing canRead(), make sure that the I/O device (device()) is left in its original state (e.g., by using peek() rather than read()).

See also
read(), QIODevice::peek()

Implements QImageIOHandler.

Definition at line 100 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::currentFrame, QImageReader::device(), QSvgIOHandlerPrivate::frameCount, QSvgIOHandlerPrivate::loadAttempted, QSvgIOHandlerPrivate::loadStatus, and QSvgIOHandlerPrivate::readDone.

Referenced by QSvgIOHandlerPrivate::load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ canRead() [2/2]

bool QSvgIOHandler::canRead ( QIODevice * device)
static

Definition at line 295 of file qsvgiohandler.cpp.

◆ currentImageNumber()

int QSvgIOHandler::currentImageNumber ( ) const
overridevirtual

For image formats that support animation, this function returns the sequence number of the current image in the animation.

If this function is called before any image is read(), -1 is returned. The number of the first image in the sequence is 0.

If the image format does not support animation, 0 is returned.

See also
read()

Reimplemented from QImageIOHandler.

Definition at line 287 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::currentFrame, and QSvgIOHandlerPrivate::readDone.

◆ imageCount()

int QSvgIOHandler::imageCount ( ) const
overridevirtual

For image formats that support animation, this function returns the number of images in the animation.

If the image format does not support animation, or if it is unable to determine the number of images, 0 is returned.

The default implementation returns 1 if canRead() returns true; otherwise 0 is returned.

Reimplemented from QImageIOHandler.

Definition at line 277 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::frameCount.

◆ jumpToImage()

bool QSvgIOHandler::jumpToImage ( int imageNumber)
overridevirtual

For image formats that support animation, this function jumps to the image whose sequence number is imageNumber.

The next call to read() will attempt to read this image.

The default implementation does nothing, and returns false.

Reimplemented from QImageIOHandler.

Definition at line 262 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::currentFrame, QImageReader::device(), QSvgIOHandlerPrivate::frameCount, and QSvgIOHandlerPrivate::load().

Referenced by jumpToNextImage().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ jumpToNextImage()

bool QSvgIOHandler::jumpToNextImage ( )
overridevirtual

For image formats that support animation, this function jumps to the next image.

The default implementation does nothing, and returns false.

Reimplemented from QImageIOHandler.

Definition at line 257 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::currentFrame, and jumpToImage().

Here is the call graph for this function:

◆ loopCount()

int QSvgIOHandler::loopCount ( ) const
overridevirtual

For image formats that support animation, this function returns the number of times the animation should loop.

If the image format does not support animation, 0 is returned.

Reimplemented from QImageIOHandler.

Definition at line 272 of file qsvgiohandler.cpp.

◆ nextImageDelay()

int QSvgIOHandler::nextImageDelay ( ) const
overridevirtual

For image formats that support animation, this function returns the number of milliseconds to wait until reading the next image.

If the image format does not support animation, 0 is returned.

Reimplemented from QImageIOHandler.

Definition at line 282 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::frameDelay.

◆ option()

QVariant QSvgIOHandler::option ( ImageOption option) const
overridevirtual

Returns the value assigned to option as a QVariant.

The type of the value depends on the option. For example, option(Size) returns a QSize variant.

See also
setOption(), supportsOption()

Reimplemented from QImageIOHandler.

Definition at line 184 of file qsvgiohandler.cpp.

References QImageReader::device(), and QSvgIOHandlerPrivate::load().

Here is the call graph for this function:

◆ read()

bool QSvgIOHandler::read ( QImage * image)
overridevirtual

Read an image from the device, and stores it in image.

Returns true if the image is successfully read; otherwise returns false.

For image formats that support incremental loading, and for animation formats, the image handler can assume that image points to the previous frame.

See also
canRead()

Implements QImageIOHandler.

Definition at line 122 of file qsvgiohandler.cpp.

References QSvgIOHandlerPrivate::currentFrame, QImageReader::device(), QSvgIOHandlerPrivate::frameCount, QSvgIOHandlerPrivate::load(), QPaintEngine::QPainter, and QSvgIOHandlerPrivate::readDone.

Here is the call graph for this function:

◆ setOption()

void QSvgIOHandler::setOption ( ImageOption option,
const QVariant & value )
overridevirtual

Sets the option option with the value value.

See also
option(), ImageOption

Reimplemented from QImageIOHandler.

Definition at line 217 of file qsvgiohandler.cpp.

◆ supportsOption()

bool QSvgIOHandler::supportsOption ( ImageOption option) const
overridevirtual

Returns true if the QImageIOHandler supports the option option; otherwise returns false.

For example, if the QImageIOHandler supports the \l Size option, supportsOption(Size) must return true.

See also
setOption(), option()

Reimplemented from QImageIOHandler.

Definition at line 238 of file qsvgiohandler.cpp.


The documentation for this class was generated from the following files: