Qt 4.8
Public Functions | Public Variables | List of all members
QSvgIOHandlerPrivate Class Reference

Public Functions

bool load (QIODevice *device)
 
 QSvgIOHandlerPrivate (QSvgIOHandler *qq)
 

Public Variables

QColor backColor
 
QRect clipRect
 
QSize defaultSize
 
bool loaded
 
QSvgIOHandlerq
 
QSvgRenderer r
 
bool readDone
 
QRect scaledClipRect
 
QSize scaledSize
 
QXmlStreamReader xmlReader
 

Detailed Description

Definition at line 56 of file qsvgiohandler.cpp.

Constructors and Destructors

◆ QSvgIOHandlerPrivate()

QSvgIOHandlerPrivate::QSvgIOHandlerPrivate ( QSvgIOHandler qq)
inline

Definition at line 59 of file qsvgiohandler.cpp.

Functions

◆ load()

bool QSvgIOHandlerPrivate::load ( QIODevice device)

Definition at line 78 of file qsvgiohandler.cpp.

Referenced by QSvgIOHandler::option(), QSvgIOHandlerPrivate(), and QSvgIOHandler::read().

79 {
80  if (loaded)
81  return true;
82  if (q->format().isEmpty())
83  q->canRead();
84 
85  // # The SVG renderer doesn't handle trailing, unrelated data, so we must
86  // assume that all available data in the device is to be read.
87  bool res = false;
88  QBuffer *buf = qobject_cast<QBuffer *>(device);
89  if (buf) {
90  const QByteArray &ba = buf->data();
91  res = r.load(QByteArray::fromRawData(ba.constData() + buf->pos(), ba.size() - buf->pos()));
92  buf->seek(ba.size());
93  } else if (q->format() == "svgz") {
94  res = r.load(device->readAll());
95  } else {
96  xmlReader.setDevice(device);
97  res = r.load(&xmlReader);
98  }
99 
100  if (res) {
102  loaded = true;
103  }
104 
105  return loaded;
106 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QXmlStreamReader xmlReader
const QByteArray & data() const
Returns the data contained in the buffer.
Definition: qbuffer.cpp:301
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
qint64 pos() const
Reimplemented Function
Definition: qbuffer.cpp:367
The QBuffer class provides a QIODevice interface for a QByteArray.
Definition: qbuffer.h:57
QRectF viewBox
Returns viewBoxF().toRect().
Definition: qsvgrenderer.h:68
bool seek(qint64 off)
Reimplemented Function
Definition: qbuffer.cpp:384
QByteArray format() const
Returns the format that is currently assigned to QImageIOHandler.
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
static QByteArray fromRawData(const char *, int size)
Constructs a QByteArray that uses the first size bytes of the data array.
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
void setDevice(QIODevice *device)
Sets the current device to device.
Definition: qxmlstream.cpp:489
bool load(const QString &filename)
Loads the SVG file specified by filename, returning true if the content was successfully parsed; othe...
QSvgIOHandler * q
QByteArray readAll()
Reads all available data from the device, and returns it as a QByteArray.
Definition: qiodevice.cpp:1025
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
virtual bool canRead() const
Returns true if an image can be read from the device (i.

Properties

◆ backColor

QColor QSvgIOHandlerPrivate::backColor

◆ clipRect

QRect QSvgIOHandlerPrivate::clipRect

◆ defaultSize

QSize QSvgIOHandlerPrivate::defaultSize

Definition at line 68 of file qsvgiohandler.cpp.

Referenced by load(), QSvgIOHandler::option(), and QSvgIOHandler::read().

◆ loaded

bool QSvgIOHandlerPrivate::loaded

Definition at line 72 of file qsvgiohandler.cpp.

Referenced by QSvgIOHandler::canRead(), and load().

◆ q

QSvgIOHandler* QSvgIOHandlerPrivate::q

Definition at line 65 of file qsvgiohandler.cpp.

Referenced by load().

◆ r

QSvgRenderer QSvgIOHandlerPrivate::r

Definition at line 66 of file qsvgiohandler.cpp.

Referenced by load(), and QSvgIOHandler::read().

◆ readDone

bool QSvgIOHandlerPrivate::readDone

Definition at line 73 of file qsvgiohandler.cpp.

Referenced by QSvgIOHandler::canRead(), and QSvgIOHandler::read().

◆ scaledClipRect

QRect QSvgIOHandlerPrivate::scaledClipRect

◆ scaledSize

QSize QSvgIOHandlerPrivate::scaledSize

◆ xmlReader

QXmlStreamReader QSvgIOHandlerPrivate::xmlReader

Definition at line 67 of file qsvgiohandler.cpp.

Referenced by load().


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