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
qsvggenerator.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSVGGENERATOR_H
5#define QSVGGENERATOR_H
6
7#include <QtGui/qpaintdevice.h>
8
9#ifndef QT_NO_SVGGENERATOR
10
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>
16
17QT_BEGIN_NAMESPACE
18
19
20class QSvgGeneratorPrivate;
21
22class Q_SVG_EXPORT QSvgGenerator : public QPaintDevice
23{
24 Q_DECLARE_PRIVATE(QSvgGenerator)
25
26 // Not a QObject; just a hack to get documentation from qdoc
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)
34public:
35 enum class SvgVersion {
36 SvgTiny12,
37 Svg11,
38 };
39
40 QSvgGenerator();
41 explicit QSvgGenerator(SvgVersion version);
42 ~QSvgGenerator();
43
44 QString title() const;
45 void setTitle(const QString &title);
46
47 QString description() const;
48 void setDescription(const QString &description);
49
50 QSize size() const;
51 void setSize(const QSize &size);
52
53 QRect viewBox() const;
54 QRectF viewBoxF() const;
55 void setViewBox(const QRect &viewBox);
56 void setViewBox(const QRectF &viewBox);
57
58 QString fileName() const;
59 void setFileName(const QString &fileName);
60
61 QIODevice *outputDevice() const;
62 void setOutputDevice(QIODevice *outputDevice);
63
64 void setResolution(int dpi);
65 int resolution() const;
66
67 SvgVersion svgVersion() const;
68protected:
69 QPaintEngine *paintEngine() const override;
70 int metric(QPaintDevice::PaintDeviceMetric metric) const override;
71
72private:
73 QScopedPointer<QSvgGeneratorPrivate> d_ptr;
74};
75
76QT_END_NAMESPACE
77
78#endif // QT_NO_SVGGENERATOR
79#endif // QSVGGENERATOR_H
\inmodule QtGui
Definition qimage.h:37
QSvgPaintEngine * engine
\inmodule QtSvg
bool isClippingEffective() const
QSvgPaintEnginePrivate(QSvgGenerator::SvgVersion version)
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
int resolution() 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)
QRectF viewBox() const
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.
QSize size() const
bool qHasPixmapTexture(const QBrush &)
Definition qbrush.cpp:206
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)