CopperSpice API
1.9.2
|
The QSvgGenerator class provides a paint device that is used to create SVG drawings. More...
Public Methods | |
QSvgGenerator () | |
~QSvgGenerator () | |
void | setViewBox (const QRect &viewBox) |
void | setViewBox (const QRectF &viewBox) |
QRect | viewBox () const |
QRectF | viewBoxF () const |
Public Methods inherited from QPaintDevice | |
virtual | ~QPaintDevice () |
int | colorCount () const |
int | depth () const |
int | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
int | width () const |
int | widthMM () const |
Protected Methods | |
int | metric (QPaintDevice::PaintDeviceMetric metric) const override |
QPaintEngine * | paintEngine () const override |
Protected Methods inherited from QPaintDevice | |
QPaintDevice () | |
Properties | |
description | |
fileName | |
outputDevice | |
resolution | |
size | |
title | |
viewBox | |
Additional Inherited Members | |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric |
The QSvgGenerator class provides a paint device that is used to create SVG drawings. 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 fileName or outputDevice properties. It is usually necessary to specify the size of the drawing by setting the size property, and in some cases where the drawing will be included in another, the 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:
Painting is performed in the same way as for any other paint device. However, it is necessary to use the QPainter::begin() and end() to explicitly begin and end painting on the device.
QSvgGenerator::QSvgGenerator | ( | ) |
Constructs a new generator.
QSvgGenerator::~QSvgGenerator | ( | ) |
Destroys the generator.
|
overrideprotectedvirtual |
Reimplemented from QPaintDevice::metric()
|
overrideprotectedvirtual |
Returns the paint engine used to render graphics to be converted to SVG format information.
Implements QPaintDevice::paintEngine()
void QSvgGenerator::setViewBox | ( | const QRect & | viewBox | ) |
Sets the value of the QSvgGenerator::viewBox property to viewBox.
void QSvgGenerator::setViewBox | ( | const QRectF & | viewBox | ) |
Sets the value of the QSvgGenerator::viewBox property to viewBox.
QRect QSvgGenerator::viewBox | ( | ) | const |
Equivalent to calling viewBoxF().toRect().
QRectF QSvgGenerator::viewBoxF | ( | ) | const |
Returns the value of the QSvgGenerator::viewBox property.
|
This property holds the description of the generated SVG drawing.
Properties | Class Methods |
---|---|
read | description |
write | setDescription |
|
This property holds the target filename for the generated SVG drawing.
Properties | Class Methods |
---|---|
read | fileName |
write | setFileName |
|
This property holds the output device for the generated SVG drawing. If both output device and file name are specified, the output device will have precedence.
Properties | Class Methods |
---|---|
read | outputDevice |
write | setOutputDevice |
|
This property holds 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.
Properties | Class Methods |
---|---|
read | resolution |
write | setResolution |
|
This property holds 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.
Properties | Class Methods |
---|---|
read | size |
write | setSize |
|
This property holds the title of the generated SVG drawing.
Properties | Class Methods |
---|---|
read | title |
write | setTitle |
|
This property holds the viewBox of the generated SVG drawing. By default this property is set to QRect(0, 0, -1, -1)
, which indicates the generator should not output the viewBox attribute of the <svg> element.
Properties | Class Methods |
---|---|
read | viewBoxF |
write | setViewBox |