Skip to content

PythonQt.QtSvg.QSvgRenderer

QSvgRenderer

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

Using QSvgRenderer, Scalable Vector Graphics (SVG) can be rendered onto any QPaintDevice subclass, including QWidget, QImage, and QGLWidget.

QSvgRenderer provides an API that supports basic features of SVG rendering, such as loading and rendering of static drawings, and more interactive features like animation. Since the rendering is performed using QPainter, SVG drawings can be rendered on any subclass of QPaintDevice.

SVG drawings are either loaded when an QSvgRenderer is constructed, or loaded later using the load() functions. Data is either supplied directly as serialized XML, or indirectly using a file name. If a valid file has been loaded, either when the renderer is constructed or at some later time, isValid() returns true; otherwise it returns false. QSvgRenderer provides the render() slot to render the current document, or the current frame of an animated document, using a given painter.

The defaultSize() function provides information about the amount of space that is required to render the currently loaded SVG file. This is useful for paint devices, such as QWidget, that often need to supply a size hint to their parent layout. The default size of a drawing may differ from its visible area, found using the viewBox property.

Animated SVG drawings are supported, and can be controlled with a simple collection of functions and properties:

  • The animated() function indicates whether a drawing contains animation information.
  • The framesPerSecond property contains the rate at which the animation plays.

Finally, the QSvgRenderer class provides the repaintNeeded() signal which is emitted whenever the rendering of the document needs to be updated.

Source: https://doc.qt.io/archives/qt-5.15/qsvgrenderer.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
animated function (self) -> bool X.animated() -> bool
animationDuration function (self) -> int X.animationDuration() -> int
aspectRatioMode attribute Any How rendering adheres to the SVG view box aspect ratio
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
boundsOnElement function (self, id: str) -> Any X.boundsOnElement(id) -> PythonQt.QtCore.QRectF
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
currentFrame attribute int
customEvent function (self, event: Any) -> Any (shared captured text)
defaultSize function (self) -> Any X.defaultSize() -> PythonQt.QtCore.QSize
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtSvg.QSvgRenderer.destroyed; argument details are not documented.
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
elementExists function (self, id: str) -> bool X.elementExists(id) -> bool
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
framesPerSecond attribute int This property holds the number of frames per second to be shown
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
load function (self, filename: Any) -> bool X.load(filename) -> bool
matrixForElement function (self, id: str) -> Any X.matrixForElement(id) -> PythonQt.QtGui.QMatrix
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtSvg.QSvgRenderer.objectNameChanged; argument details are not documented.
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
render function (self, p: Any, elementId: Any, bounds: Any) -> None X.render(p, elementId, bounds)
repaintNeeded function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtSvg.QSvgRenderer.repaintNeeded; argument details are not documented.
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setCurrentFrame function (self, arg__1: int) -> None
setFramesPerSecond function (self, num: int) -> None
setObjectName function (self, name: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setViewBox function (self, viewbox: Any) -> None
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
viewBox attribute QRectF This property holds the rectangle specifying the visible area of the document in logical coordinates
viewBoxF function (self) -> Any X.viewBoxF() -> PythonQt.QtCore.QRectF