Class: QgsScaleBarRendererRegistry

A registry which manages registered scalebar renderers.

A reference to the QgsScaleBarRendererRegistry can be obtained from QgsApplication.scalebarRendererRegistry().

Added in version 3.14.

Methods

addRenderer

Adds a new renderer to the registry.

removeRenderer

Removes the renderer with matching id from the registry.

renderer

Creates a new scalebar renderer by id.

renderers

Returns a list of the renderer ids currently contained in the registry.

sortKey

Returns the sorting key for the renderer with matching id.

sortedRendererList

Returns a list of the renderer ids currently contained in the registry, sorted in an order respecting the renderer's sort keys and display strings.

visibleName

Returns the translated, user-visible name for the renderer with matching id.

class qgis.core.QgsScaleBarRendererRegistry[source]

Bases: object

__init__()

You should not normally need to create your own scalebar renderer registry.

Use the one provided by :py:func:`QgsApplication.scalebarRendererRegistry()` instead.

__init__(a0: QgsScaleBarRendererRegistry)
Parameters:

a0 (QgsScaleBarRendererRegistry)

addRenderer(self, renderer: QgsScaleBarRenderer | None)[source]

Adds a new renderer to the registry.

Ownership is transferred to the registry.

Parameters:

renderer (Optional[QgsScaleBarRenderer])

removeRenderer(self, id: str | None)[source]

Removes the renderer with matching id from the registry.

Parameters:

id (Optional[str])

renderer(self, id: str | None) QgsScaleBarRenderer | None[source]

Creates a new scalebar renderer by id. If there is no such id registered, None will be returned instead.

The caller takes ownership of the returned object.

Parameters:

id (Optional[str])

Return type:

Optional[QgsScaleBarRenderer]

renderers(self) List[str][source]

Returns a list of the renderer ids currently contained in the registry.

Return type:

List[str]

sortKey(self, id: str | None) int[source]

Returns the sorting key for the renderer with matching id.

Parameters:

id (Optional[str])

Return type:

int

sortedRendererList(self) List[str][source]

Returns a list of the renderer ids currently contained in the registry, sorted in an order respecting the renderer’s sort keys and display strings.

Return type:

List[str]

visibleName(self, id: str | None) str[source]

Returns the translated, user-visible name for the renderer with matching id.

Parameters:

id (Optional[str])

Return type:

str