Skip to content

Latest commit

 

History

History
166 lines (122 loc) · 5.3 KB

qtsvg.md

File metadata and controls

166 lines (122 loc) · 5.3 KB

QtSvg Bindings

The package qtsvg contains bindings for classes defined by the Qt module QtSvg.

Besides the capabilites reported below, all qt variants inherit a set of default methods, and all qt object classes inherit the capabilities from their superclasses and automatically expose properties, slots and signals.

You can also use the function qtwidget.newpdf, defined in module qtwidget, to easily generate SVG files.

qtsvg.loadsvg(filename)

Returns a Qt object of class qt.QSvgRenderer representing the SVG file filename.

qtsvg.paintsvg(port,svg,...)

Draws a SVG image.

Argument port must be a qt.QtLuaPainter or a qtwidget'' high level port descriptor. Argument svg can be the SVG filename or an instance of class qt.QSvgRenderer such as those returned by function qtsvg.loadsvg. The remaining arguments are the same as those for the C++ function QSvgRenderer::render.

qt.QSvgWidget

Class QSvgWidget provides a widget that is used to display the contents of Scalable Vector Graphics (SVG) files.

qt.QSvgWidget([filename],[parent])

Expression qt.QSvgWidget(parent) returns a new widget for rendering SVG data.

The optional argument filename specifies the name of a file containing the SVG data. Without this argument, you must use slot qsvgwidget:load() to load SVG data.

The optional argument parent specifies the widget parent. New widgets are always created from the main thread using the thread hopping mechanism. When argument parent is nil or not specified, the new widget is owned by the Lua interpreter and is automatically destroyed when the garbage collector determines that it is no longer referenced.

qsvgwidget:renderer()

Returns the qt.QSvgRenderer object associated with this widget.

qt.QSvgRenderer

Class QSvgRenderer is used to draw the contents of SVG files onto paint devices. You should use instead function qtsvg.paintsvg to easily display SVG data.

qt.QSvgRenderer([filename],[parent])

Creates a new instance of class QSvgRenderer.

The optional argument filename specifies the name of a file containing the SVG data. Without this argument, you must use slot qsvgwidget:load() to load SVG data.

The optional argument parent specifies the widget parent. When argument parent is nil or not specified, the new widget is owned by the Lua interpreter and is automatically destroyed when the garbage collector determines that it is no longer referenced.

qt.QtLuaSvgGenerator

This is a thin wrapper around the Qt class QSvgGenerator.

You should use instead function qtwidget.newpdf to easily generate SVG files.

qt.QtLuaSvgGenerator([filename],[parent])

Creates a new instance of class QtLuaSvgGenerator.

When argument filename is present, the SVG data is written into the specified file. Otherwise it is written into a memory buffer accessible using the method qsvggenerator:data().

The optional argument parent specifies the widget parent. When argument parent is nil or not specified, the new widget is owned by the Lua interpreter and is automatically destroyed when the garbage collector determines that it is no longer referenced.

qtluasvggenerator:data()

Assuming the qtluasvggenerator was created without the filename argument, this function returns a qt.QByteArray containing the generated SVG data. This data may be incomplete until painter:close() has been closed on all painters operating on qtluasvggenerator.

qtluasvggenerator.description

Starting with Qt-4.5, this string property defines the contents of the <desc> tag of the SVG file.

qtluasvggenerator.title

Starting with Qt-4.5, this string property defines the contents of the <title> tag of the SVG file.

qtluasvggenerator.size

This property contains a qt.QSize variant containing the size of the drawable area. This information is shown in the viewBox attribute of the <svg> tag.

qtluasvggenerator.resolution

This integer property defines the resolution, in dots per inch, of the coordinate system. Together with qtluasvggenerator.size, this property determines the contents of the width and height attributes of the <svg> tag.