7#ifndef QT_NO_SVGRENDERER
9#include <QtCore/qobject.h>
10#include <QtCore/qsize.h>
11#include <QtCore/qrect.h>
12#include <QtCore/qxmlstream.h>
13#include <QtSvg/qtsvgglobal.h>
27 Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox)
28 Q_PROPERTY(
int framesPerSecond READ framesPerSecond WRITE setFramesPerSecond)
29 Q_PROPERTY(
int currentFrame READ currentFrame WRITE setCurrentFrame)
30 Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
31 Q_PROPERTY(QtSvg::Options options READ options WRITE setOptions)
32 Q_PROPERTY(
bool animationEnabled READ isAnimationEnabled WRITE setAnimationEnabled)
34 QSvgRenderer(QObject *parent =
nullptr);
35 QSvgRenderer(
const QString &filename, QObject *parent =
nullptr);
36 QSvgRenderer(
const QByteArray &contents, QObject *parent =
nullptr);
37 QSvgRenderer(QXmlStreamReader *contents, QObject *parent =
nullptr);
42 QSize defaultSize()
const;
44 QRect viewBox()
const;
45 QRectF viewBoxF()
const;
46 void setViewBox(
const QRect &viewbox);
47 void setViewBox(
const QRectF &viewbox);
49 Qt::AspectRatioMode aspectRatioMode()
const;
50 void setAspectRatioMode(Qt::AspectRatioMode mode);
52 QtSvg::Options options()
const;
53 void setOptions(QtSvg::Options flags);
55 bool animated()
const;
56 int framesPerSecond()
const;
57 void setFramesPerSecond(
int num);
58 int currentFrame()
const;
59 void setCurrentFrame(
int);
60 int animationDuration()
const;
61 bool isAnimationEnabled()
const;
62 void setAnimationEnabled(
bool enable);
64 QRectF boundsOnElement(
const QString &id)
const;
65 bool elementExists(
const QString &id)
const;
66 QTransform transformForElement(
const QString &id)
const;
68 static void setDefaultOptions(QtSvg::Options flags);
71 bool load(
const QString &filename);
72 bool load(
const QByteArray &contents);
73 bool load(QXmlStreamReader *contents);
74 void render(QPainter *p);
75 void render(QPainter *p,
const QRectF &bounds);
77 void render(QPainter *p,
const QString &elementId,
78 const QRectF &bounds=QRectF());
84 Q_DECLARE_PRIVATE(QSvgRenderer)
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QString pmcKey(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) const
bool tryLoad(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state)
static int hashKey(QIcon::Mode mode, QIcon::State state)
static QAtomicInt lastSerialNum
QHash< int, QByteArray > svgBuffers
QMultiHash< int, QPixmap > addedPixmaps
QHash< int, QString > svgFiles
QIcon::Mode loadDataForModeAndState(QSvgRenderer *renderer, QIcon::Mode mode, QIcon::State state)
QIconEngine * clone() const override
Reimplement this method to return a clone of this icon engine.
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override
Returns the icon as a pixmap with the required size, mode, and state.
QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override
void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) override
Called by QIcon::addFile().
QSvgIconEngine(const QSvgIconEngine &other)
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override
Returns the actual size of the icon the engine provides for the requested size, mode and state.
void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) override
Called by QIcon::addPixmap().
QString key() const override
\variable QIconEngine::ScaledPixmapArgument::size
static QByteArray maybeUncompress(const QByteArray &ba)
static FileType fileType(const QFileInfo &fi)