The svg module

A page that can display a SVG document.

class SvgPage(svgrenderer, renderer=None)[source]


A page that can display a SVG document.

dpi = 90.0
classmethod load(filename, renderer=None)[source]

Load a SVG document from filename, which may also be a QByteArray.

Yields only one Page instance, as SVG currently supports one page per file. If the file can’t be loaded by the underlying QSvgRenderer, no Page is yielded.


Return an object that should be locked when rendering the page.

Page are guaranteed not to be rendered at the same time when they return the same mutex object. By default, None is returned.


Return the group the page belongs to.

This could be some document structure, so that different Page objects could refer to the same graphical contents, preventing double caching.

This object is used together with the value returned by ident() as a key to cache the page. The idea is that the contents of the page are uniquely identified by the objects returned by group() and ident().

This way, when the same document is opened in multiple page instances, only one copy resides in the (global) cache.

By default, the page object itself is returned.

renderer = <qpageview.svg.SvgRenderer object>
class SvgDocument(sources=(), renderer=None)[source]

Bases: qpageview.document.MultiSourceDocument

A Document representing a group of SVG files.


alias of qpageview.svg.SvgPage


Implement this method to create and yield the pages.

This method is only called once. After altering filename,-s or source,-s, or invalidate(), it is called again.

class SvgRenderer(cache=None)[source]

Bases: qpageview.render.AbstractRenderer

Render SVG pages.


Sets the renderhints for the painter we want to use.

draw(page, painter, key, tile, paperColor=None)[source]

Draw the specified tile of the page (coordinates in key) on painter.