7#include <QtGui/qpaintdevice.h>
9#ifndef QT_NO_SVGGENERATOR
11#include <QtCore/qnamespace.h>
12#include <QtCore/qiodevice.h>
13#include <QtCore/qobjectdefs.h>
14#include <QtCore/qscopedpointer.h>
15#include <QtSvg/qtsvgglobal.h>
20class QSvgGeneratorPrivate;
24 Q_DECLARE_PRIVATE(QSvgGenerator)
27 Q_PROPERTY(QSize size READ size WRITE setSize)
28 Q_PROPERTY(QRectF viewBox READ viewBoxF WRITE setViewBox)
29 Q_PROPERTY(QString title READ title WRITE setTitle)
30 Q_PROPERTY(QString description READ description WRITE setDescription)
31 Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
32 Q_PROPERTY(QIODevice* outputDevice READ outputDevice WRITE setOutputDevice)
33 Q_PROPERTY(
int resolution READ resolution WRITE setResolution)
35 enum class SvgVersion {
41 explicit QSvgGenerator(SvgVersion version);
44 QString title()
const;
45 void setTitle(
const QString &title);
47 QString description()
const;
48 void setDescription(
const QString &description);
51 void setSize(
const QSize &size);
53 QRect viewBox()
const;
54 QRectF viewBoxF()
const;
55 void setViewBox(
const QRect &viewBox);
56 void setViewBox(
const QRectF &viewBox);
58 QString fileName()
const;
59 void setFileName(
const QString &fileName);
61 QIODevice *outputDevice()
const;
62 void setOutputDevice(QIODevice *outputDevice);
64 void setResolution(
int dpi);
65 int resolution()
const;
67 SvgVersion svgVersion()
const;
69 QPaintEngine *paintEngine()
const override;
70 int metric(QPaintDevice::PaintDeviceMetric metric)
const override;
73 QScopedPointer<QSvgGeneratorPrivate> d_ptr;
QString generateClipPathName()
bool isClippingEffective() const
QString currentGradientName
QStringList savedPatternMasks
QStringList savedPatternBrushes
QString currentClipPathName
QSvgPaintEnginePrivate(QSvgGenerator::SvgVersion version)
QString generateGradientName()
std::optional< QPainterPath > clipPath
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor) override
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
bool end() override
Reimplement this function to finish painting on the current paint device.
void generateImage(QTextStream &stream, const QRectF &r, const QImage &pm)
void setSize(const QSize &size)
QIODevice * outputDevice() const
void drawEllipse(const QRectF &r) override
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
void setDocumentTitle(const QString &title)
QString documentDescription() const
void drawPath(const QPainterPath &path) override
The default implementation ignores the path and does nothing.
void updateClipState(const QPaintEngineState &state)
QString documentTitle() const
void drawTextItem(const QPointF &pt, const QTextItem &item) override
This function draws the text item textItem at position p.
void setViewBox(const QRectF &viewBox)
void setResolution(int resolution)
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
void setDocumentDescription(const QString &description)
void setOutputDevice(QIODevice *device)
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void updateState(const QPaintEngineState &state) override
Reimplement this function to update the state of a paint engine.
QPaintEngine::Type type() const override
Reimplement this function to return the paint engine \l{Type}.
void drawRects(const QRectF *rects, int rectCount) override
Draws the first rectCount rectangles in the buffer rects.
bool qHasPixmapTexture(const QBrush &)
static void translate_dashPattern(const QList< qreal > &pattern, qreal width, QString *pattern_string)
static QPaintEngine::PaintEngineFeatures svgEngineFeatures()
static QT_BEGIN_NAMESPACE void translate_color(const QColor &color, QString *color_string, QString *opacity_string)
QString document_description