Class: QgsPluginLayer

Base class for plugin layers.

These can be implemented by plugins and registered in QgsPluginLayerRegistry.

In order to be readable from project files, they should set these attributes in layer DOM node:

  • “type” = “plugin”

  • “name” = “your_layer_type”

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsMapLayer.createMapRenderer(), QgsMapLayer.readSymbology(), QgsMapLayer.setTransformContext(), QgsMapLayer.writeSymbology()

Class Hierarchy

Inheritance diagram of qgis.core.QgsPluginLayer

Base classes

QgsMapLayer

Base class for all map layer types.

QObject

Abstract Methods

clone

Returns a new instance equivalent to this one.

Methods

pluginLayerType

Returns plugin layer type (the same as used in QgsPluginLayerRegistry)

setSource

Set source string.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsPluginLayer. See the FAQ for more details.

icon

Returns an icon for the layer.

setExtent

Sets extent of the layer

class qgis.core.QgsPluginLayer[source]

Bases: QgsMapLayer

abstract clone(self) QgsPluginLayer | None[source]

Returns a new instance equivalent to this one.

Return type:

Optional[QgsPluginLayer]

Returns:

a new layer instance

virtual icon(self) QIcon[source]

Returns an icon for the layer.

Added in version 3.42.

Return type:

QIcon

pluginLayerType(self) str[source]

Returns plugin layer type (the same as used in QgsPluginLayerRegistry)

Return type:

str

virtual setExtent(self, extent: QgsRectangle)[source]

Sets extent of the layer

Parameters:

extent (QgsRectangle)

setSource(self, source: str | None)[source]

Set source string. This is used for example in layer tree to show tooltip.

Parameters:

source (Optional[str])