edifice.ImageSvg#

class edifice.ImageSvg(src, **kwargs)[source]#

Bases: QtWidgetElement[QSvgWidget]

Render an SVG image.

Props

All props from QtWidgetElement, plus:

Parameters:

src (str | QByteArray) – Either a path to an SVG image file, or a QByteArray containing the XML string of an SVG file.

Usage

henomaru = QByteArray.fromStdString(
    '<svg viewBox="0 0 200 200"><circle fill="red" cx="100" cy="100" r="100"/></svg>'
)

ImageSvg(
    src=henomaru,
    style={"width": 100, "height": 100},
)

Use the ImageSvg Element to render icons.

Find icons on websites like Font Awesome: https://fontawesome.com/

The recommended method is to copy the icon’s SVG code and paste it into QByteArray.fromStdString() as in the example above. Then pass the QByteArray to the src prop.

Or you can download an icon .svg file and render the icon by setting the src prop to the path of the file.

Methods

__init__(src, **kwargs)

register_ref(reference)

Registers provided Reference to this Element.

set_key(key)

Set the key of an Element.

Attributes

children

The children of this Element.

props

The props of this Element.

underlying

The underlying QWidget, which may not exist if this Element has not rendered.