57 #ifndef QT_NO_COMPRESS 65 , m_widthPercent(false)
66 , m_heightPercent(false)
68 , m_animationDuration(0)
77 #ifndef QT_NO_COMPRESS 78 # ifdef QT_BUILD_INTERNAL 95 int zlibResult = Z_OK;
102 zlibStream.next_in = Z_NULL;
103 zlibStream.avail_in = 0;
104 zlibStream.avail_out = 0;
105 zlibStream.zalloc = Z_NULL;
106 zlibStream.zfree = Z_NULL;
107 zlibStream.opaque = Z_NULL;
110 if (inflateInit2(&zlibStream, MAX_WBITS + 16) != Z_OK) {
111 qWarning(
"Cannot initialize zlib, because: %s",
112 (zlibStream.msg != NULL ? zlibStream.msg :
"Unknown error"));
116 bool stillMoreWorkToDo =
true;
117 while (stillMoreWorkToDo) {
119 if (!zlibStream.avail_in) {
120 source = device->
read(CHUNK_SIZE);
125 zlibStream.avail_in = source.
size();
126 zlibStream.next_in =
reinterpret_cast<Bytef*
>(source.
data());
131 int oldSize = destination.
size();
132 destination.
resize(oldSize + CHUNK_SIZE);
133 zlibStream.next_out =
reinterpret_cast<Bytef*
>(
134 destination.
data() + oldSize - zlibStream.avail_out);
137 zlibResult =
inflate(&zlibStream, Z_NO_FLUSH);
138 switch (zlibResult) {
143 inflateEnd(&zlibStream);
144 qWarning(
"Error while inflating gzip file: %s",
145 (zlibStream.msg != NULL ? zlibStream.msg :
"Unknown error"));
146 destination.
chop(zlibStream.avail_out);
153 }
while (!zlibStream.avail_out);
155 if (zlibResult == Z_STREAM_END) {
157 if (!(zlibStream.avail_in && inflateReset(&zlibStream) == Z_OK))
158 stillMoreWorkToDo =
false;
163 destination.
chop(zlibStream.avail_out);
165 inflateEnd(&zlibStream);
172 QFile file(fileName);
174 qWarning(
"Cannot open file '%s', because: %s",
179 #ifndef QT_NO_COMPRESS 192 qWarning(
"Cannot read file '%s', because: %s (line %d)",
200 #ifndef QT_NO_COMPRESS 203 QBuffer buffer(const_cast<QByteArray *>(&contents));
296 parentApplyStack.
push(parent);
297 parent = parent->
parent();
300 for (
int i = parentApplyStack.
size() - 1; i >= 0; --i)
312 for (
int i = 0; i < parentApplyStack.
size(); ++i)
400 QRectF target = targetRect;
404 if (deviceRect.isNull()) {
414 QRectF source = sourceRect;
418 if (source != target && !source.
isNull()) {
424 target.
y() - c2.
y());
472 return int(runningPercentage * totalFrames);
478 double framePercentage = frame/double(totalFrames);
479 double timeForFrame = m_animationDuration * framePercentage;
480 timeForFrame *= 1000;
The QPainter class performs low-level painting on widgets and other paint devices.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
virtual QRectF transformedBounds(QPainter *p, QSvgExtraStates &states) const
void chop(int n)
Removes n bytes from the end of the byte array.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
void mapSourceToTarget(QPainter *p, const QRectF &targetRect, const QRectF &sourceRect=QRectF())
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
char * data()
Returns a pointer to the data stored in the byte array.
bool isReadable() const
Returns true if data can be read from the device; otherwise returns false.
void setFramesPerSecond(int num)
The QMatrix class specifies 2D transformations of a coordinate system.
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
void setWidth(int len, bool percent)
void start()
Sets this time to the current time.
bool isNull() const
Returns true if the time is null (i.
void setHeight(int len, bool percent)
The QByteArray class provides an array of bytes.
The QPointF class defines a point in the plane using floating point precision.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
QMatrix matrixForElement(const QString &id) const
void restore()
Restores the current painter state (pops a saved state off the stack).
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
QSvgTinyDocument * document() const
void addNamedStyle(const QString &id, QSvgFillStyleProperty *style)
QSvgFont * svgFont(const QString &family) const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QSvgNode * scopeNode(const QString &id) const
The QStack class is a template class that provides a stack.
long ASN1_INTEGER_get ASN1_INTEGER * a
The QBuffer class provides a QIODevice interface for a QByteArray.
void applyStyle(QPainter *p, QSvgExtraStates &states) const
QSvgNode * parent() const
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
static QByteArray qt_inflateGZipDataFrom(QIODevice *device)
bool startsWith(const QByteArray &a) const
Returns true if this byte array starts with byte array ba; otherwise returns false.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
const T value(const Key &key) const
Returns the value associated with the key.
void save()
Saves the current painter state (pushes the state onto a stack).
void setViewBox(const QRectF &rect)
int restart()
Sets this time to the current time and returns the number of milliseconds that have elapsed since the...
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool elementExists(const QString &id) const
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
void setWidth(int w)
Sets the width to the given width.
Q_CORE_EXPORT void qDebug(const char *,...)
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
QHash< QString, QSvgRefCounter< QSvgFillStyleProperty > > m_namedStyles
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
bool isOpen() const
Returns true if the device is open; otherwise returns false.
void addNamedNode(const QString &id, QSvgNode *node)
QSvgRefCounter< QSvgTransformStyle > transform
void addSvgFont(QSvgFont *)
QSvgFillStyleProperty * namedStyle(const QString &id) const
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
qreal height() const
Returns the height of the rectangle.
DisplayMode displayMode() const
Q_CORE_EXPORT void qWarning(const char *,...)
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
qreal width() const
Returns the width of the rectangle.
virtual QRectF bounds(QPainter *p, QSvgExtraStates &states) const
void push(const T &t)
Adds element t to the top of the stack.
void setCurrentFrame(int)
static int inflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourceLen)
The QList::iterator class provides an STL-style non-const iterator for QList and QQueue.
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
const QTransform & worldTransform() const
Returns the world transformation matrix.
The QFile class provides an interface for reading from and writing to files.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void resize(int size)
Sets the size of the byte array to size bytes.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
#define Q_AUTOTEST_EXPORT
int animationDuration() const
void setWorldTransform(const QTransform &matrix, bool combine=false)
Sets the world transformation matrix.
QSizeF size() const
Returns the size of the rectangle.
int size() const
Returns the number of bytes in this byte array.
virtual bool open(OpenMode mode)
Opens the device and sets its OpenMode to mode.
QString errorString() const
void scale(qreal sx, qreal sy)
Scales the coordinate system by ({sx}, {sy}).
virtual void draw(QPainter *p, QSvgExtraStates &states)=0
QTime addMSecs(int ms) const
Returns a QTime object containing a time ms milliseconds later than the time of this object (or earli...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
QString familyName() const
virtual void draw(QPainter *p, QSvgExtraStates &)
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
QImageIOHandler * handler
The QIODevice class is the base interface class of all I/O devices in Qt.
static QSvgTinyDocument * load(const QString &file)
void revertStyle(QPainter *p, QSvgExtraStates &states) const
#define qPrintable(string)
static QString fileName(const QString &fileUrl)
int size() const
Returns the number of items in the vector.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
QHash< QString, QSvgNode * > m_namedNodes
QList< QSvgNode * > m_renderers
void setMiterLimit(qreal limit)
Sets the miter limit of this pen to the given limit.
QHash< QString, QSvgRefCounter< QSvgFont > > m_fonts
QSvgNode * namedNode(const QString &id) const
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
QRectF boundsOnElement(const QString &id) const