QSvgGeneratorclass provides a paint device that is used to create SVG drawings. 更多 …
def
description
()
def
fileName
()
def
outputDevice
()
def
resolution
()
def
setDescription
(description)
def
setFileName
(fileName)
def
setOutputDevice
(outputDevice)
def
setResolution
(dpi)
def
setSize
(size)
def
setTitle
(title)
def
setViewBox
(viewBox)
def
setViewBox
(viewBox)
def
size
()
def
title
()
def
viewBox
()
def
viewBoxF
()
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
fileNameoroutputDeviceproperties. It is usually necessary to specify the size of the drawing by setting thesizeproperty, and in some cases where the drawing will be included in another, theviewBoxproperty also needs to be set.QSvgGenerator generator; generator.setFileName(path); generator.setSize(QSize(200, 200)); generator.setViewBox(QRect(0, 0, 200, 200)); generator.setTitle(tr("SVG Generator Example Drawing")); generator.setDescription(tr("An SVG drawing created by the SVG Generator " "Example provided with Qt."));Other meta-data can be specified by setting the
title,descriptionandresolution特性。As with other
QPaintDevice子类,QPainterobject is used to paint onto an instance of this class:QPainter painter; painter.begin(&generator); ... painter.end();Painting is performed in the same way as for any other paint device. However, it is necessary to use the
begin()andend()to explicitly begin and end painting on the device.SVG 生成器范例 shows how the same painting commands can be used for painting a widget and writing an SVG file.
另请参阅
QSvgRendererQSvgWidgetQt SVG C++ 类
QSvgGenerator
¶
构造新的生成器。
PySide2.QtSvg.QSvgGenerator.
description
(
)
¶
unicode
另请参阅
PySide2.QtSvg.QSvgGenerator.
fileName
(
)
¶
unicode
另请参阅
PySide2.QtSvg.QSvgGenerator.
outputDevice
(
)
¶
QIODevice
另请参阅
PySide2.QtSvg.QSvgGenerator.
resolution
(
)
¶
int
另请参阅
PySide2.QtSvg.QSvgGenerator.
setDescription
(
description
)
¶
description – unicode
另请参阅
PySide2.QtSvg.QSvgGenerator.
setFileName
(
fileName
)
¶
fileName – unicode
另请参阅
PySide2.QtSvg.QSvgGenerator.
setOutputDevice
(
outputDevice
)
¶
outputDevice
–
QIODevice
另请参阅
PySide2.QtSvg.QSvgGenerator.
setResolution
(
dpi
)
¶
dpi
–
int
另请参阅
PySide2.QtSvg.QSvgGenerator.
setViewBox
(
viewBox
)
¶
viewBox
–
QRect
PySide2.QtSvg.QSvgGenerator.
setViewBox
(
viewBox
)
¶
viewBox
–
QRectF
PySide2.QtSvg.QSvgGenerator.
title
(
)
¶
unicode
另请参阅
PySide2.QtSvg.QSvgGenerator.
viewBox
(
)
¶
QRect
返回
viewBoxF()
.toRect().
另请参阅
PySide2.QtSvg.QSvgGenerator.
viewBoxF
(
)
¶
QRectF