![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qsvggenerator.h>
Public Types | |
| enum class | SvgVersion { SvgTiny12 , Svg11 } |
| Public Types inherited from QPaintDevice | |
| enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled , PdmDevicePixelRatioF_EncodedA , PdmDevicePixelRatioF_EncodedB } |
Public Member Functions | |
| QSvgGenerator () | |
| Constructs a new generator using the SVG Tiny 1.2 profile. | |
| QSvgGenerator (SvgVersion version) | |
| ~QSvgGenerator () | |
| Destroys the generator. | |
| QString | title () const |
| void | setTitle (const QString &title) |
| QString | description () const |
| void | setDescription (const QString &description) |
| QSize | size () const |
| void | setSize (const QSize &size) |
| QRect | viewBox () const |
| QRectF | viewBoxF () const |
| void | setViewBox (const QRect &viewBox) |
| void | setViewBox (const QRectF &viewBox) |
| QString | fileName () const |
| void | setFileName (const QString &fileName) |
| QIODevice * | outputDevice () const |
| void | setOutputDevice (QIODevice *outputDevice) |
| void | setResolution (int dpi) |
| int | resolution () const |
| SvgVersion | svgVersion () const |
| Public Member Functions inherited from QPaintDevice | |
| virtual | ~QPaintDevice () |
| virtual int | devType () const |
| bool | paintingActive () const |
| int | width () const |
| int | height () const |
| int | widthMM () const |
| int | heightMM () const |
| int | logicalDpiX () const |
| int | logicalDpiY () const |
| int | physicalDpiX () const |
| int | physicalDpiY () const |
| qreal | devicePixelRatio () const |
| qreal | devicePixelRatioF () const |
| int | colorCount () const |
| int | depth () const |
Protected Member Functions | |
| QPaintEngine * | paintEngine () const override |
| Returns the paint engine used to render graphics to be converted to SVG format information. | |
| int | metric (QPaintDevice::PaintDeviceMetric metric) const override |
| \reimp | |
| void | initPainter (QPainter *) const override |
| Protected Member Functions inherited from QPaintDevice | |
| QPaintDevice () noexcept | |
| virtual QPaintDevice * | redirected (QPoint *offset) const |
| virtual QPainter * | sharedPainter () const |
| double | getDecodedMetricF (PaintDeviceMetric metricA, PaintDeviceMetric metricB) const |
Properties | |
| QSize | size |
| the size of the generated SVG drawing | |
| QRectF | viewBox |
| the viewBox of the generated SVG drawing | |
| QString | title |
| the title of the generated SVG drawing | |
| QString | description |
| the description of the generated SVG drawing | |
| QString | fileName |
| the target filename for the generated SVG drawing | |
| QIODevice * | outputDevice |
| the output device for the generated SVG drawing | |
| int | resolution |
| the resolution of the generated output | |
Additional Inherited Members | |
| Static Public Member Functions inherited from QPaintDevice | |
| static qreal | devicePixelRatioFScale () |
| static int | encodeMetricF (PaintDeviceMetric metric, double value) |
| Protected Attributes inherited from QPaintDevice | |
| ushort | painters |
\inmodule QtSvg
The QSvgGenerator class provides a paint device that is used to create SVG drawings. \reentrant
This paint device represents a Scalable Vector Graphics (SVG) drawing. Like QPrinter, it is designed as a write-only device that generates output in a specific format.
To write an SVG file, you first need to configure the output by setting the \l fileName or \l outputDevice properties. It is usually necessary to specify the size of the drawing by setting the \l size property, and in some cases where the drawing will be included in another, the \l viewBox property also needs to be set.
Other meta-data can be specified by setting the title, description and resolution properties.
As with other QPaintDevice subclasses, a QPainter object is used to paint onto an instance of this class:
\dots
Painting is performed in the same way as for any other paint device. However, it is necessary to use the QPainter::begin() and \l{QPainter::}{end()} to explicitly begin and end painting on the device.
Definition at line 22 of file qsvggenerator.h.
|
strong |
This enumeration describes the version of the SVG output of the generator.
\value SvgTiny12 The generated document follows the SVG Tiny 1.2 specification. \value Svg11 The generated document follows the SVG 1.1 specification.
| Enumerator | |
|---|---|
| SvgTiny12 | |
| Svg11 | |
Definition at line 35 of file qsvggenerator.h.
| QSvgGenerator::QSvgGenerator | ( | ) |
Constructs a new generator using the SVG Tiny 1.2 profile.
Definition at line 607 of file qsvggenerator.cpp.
|
explicit |
Constructs a new generator that uses the SVG version version.
Definition at line 617 of file qsvggenerator.cpp.
| QSvgGenerator::~QSvgGenerator | ( | ) |
Destroys the generator.
Definition at line 629 of file qsvggenerator.cpp.
| QString QSvgGenerator::description | ( | ) | const |
Definition at line 663 of file qsvggenerator.cpp.
| QString QSvgGenerator::fileName | ( | ) | const |
Definition at line 762 of file qsvggenerator.cpp.
Reimplemented from QPaintDevice.
Definition at line 896 of file qsvggenerator.cpp.
|
overrideprotectedvirtual |
| QIODevice * QSvgGenerator::outputDevice | ( | ) | const |
Definition at line 796 of file qsvggenerator.cpp.
|
overrideprotectedvirtual |
Returns the paint engine used to render graphics to be converted to SVG format information.
Implements QPaintDevice.
Definition at line 852 of file qsvggenerator.cpp.
| int QSvgGenerator::resolution | ( | ) | const |
Definition at line 824 of file qsvggenerator.cpp.
Definition at line 670 of file qsvggenerator.cpp.
Definition at line 768 of file qsvggenerator.cpp.
Definition at line 802 of file qsvggenerator.cpp.
| void QSvgGenerator::setResolution | ( | int | dpi | ) |
Definition at line 830 of file qsvggenerator.cpp.
Definition at line 697 of file qsvggenerator.cpp.
Definition at line 650 of file qsvggenerator.cpp.
Definition at line 750 of file qsvggenerator.cpp.
Definition at line 740 of file qsvggenerator.cpp.
| QSize QSvgGenerator::size | ( | ) | const |
Definition at line 691 of file qsvggenerator.cpp.
| QSvgGenerator::SvgVersion QSvgGenerator::svgVersion | ( | ) | const |
Returns the version of the SVG document that this generator is producing.
Definition at line 842 of file qsvggenerator.cpp.
| QString QSvgGenerator::title | ( | ) | const |
Definition at line 643 of file qsvggenerator.cpp.
| QRect QSvgGenerator::viewBox | ( | ) | const |
Returns viewBoxF().toRect().
Definition at line 734 of file qsvggenerator.cpp.
| QRectF QSvgGenerator::viewBoxF | ( | ) | const |
Definition at line 721 of file qsvggenerator.cpp.
|
readwrite |
the description of the generated SVG drawing
Definition at line 30 of file qsvggenerator.h.
|
readwrite |
the target filename for the generated SVG drawing
Definition at line 31 of file qsvggenerator.h.
|
readwrite |
the output device for the generated SVG drawing
If both output device and file name are specified, the output device will have precedence.
Definition at line 32 of file qsvggenerator.h.
|
readwrite |
the resolution of the generated output
The resolution is specified in dots per inch, and is used to calculate the physical size of an SVG drawing.
Definition at line 33 of file qsvggenerator.h.
|
readwrite |
the size of the generated SVG drawing
By default this property is set to {QSize(-1, -1)}, which indicates that the generator should not output the width and height attributes of the <svg> element.
Definition at line 27 of file qsvggenerator.h.
|
readwrite |
the title of the generated SVG drawing
Definition at line 29 of file qsvggenerator.h.
|
readwrite |
the viewBox of the generated SVG drawing
By default this property is set to {QRect(0, 0, -1, -1)}, which indicates that the generator should not output the viewBox attribute of the <svg> element.
Definition at line 28 of file qsvggenerator.h.