Class: QgsPluginLayer¶
- class qgis.core.QgsPluginLayer¶
Bases:
QgsMapLayer
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”
Methods
Add error message
Returns a new instance equivalent to this one.
- rtype:
QgsDataProvider
Called by
readLayerXML()
, used by derived classes to decode provider's specific data source from project files.Called by
writeLayerXML()
, used by derived classes to encode provider's specific data source to project files.Checks whether a new set of dependencies will introduce a cycle this method is now deprecated and always return
False
, because circular dependencies are now correctly managed.Invalidates the WGS84 extent.
Returns plugin layer type (the same as used in
QgsPluginLayerRegistry
)Read style data common to all layer types
Read custom properties from project file.
Read style manager's configuration (if any).
Called by
readLayerXML()
, used by children to read state specific to them from project files.Sets error message
Sets extent of the layer
Sets the
providerType
(provider key)Set source string.
Sets whether layer is valid or not
Write style data common to all layer types
Write custom properties to project file.
Write style manager's configuration (if exists).
Called by
writeLayerXML()
, used by children to write state specific to them to project files.- appendError(self, error: QgsErrorMessage)¶
Add error message
- childEvent(self, QChildEvent)¶
- clone(self) QgsPluginLayer ¶
Returns a new instance equivalent to this one.
- Return type:
- Returns:
a new layer instance
New in version 3.0.
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- dataProvider(self) QgsDataProvider ¶
- Return type:
- decodedSource(self, source: str, dataProvider: str, context: QgsReadWriteContext) str ¶
Called by
readLayerXML()
, used by derived classes to decode provider’s specific data source from project files. Typically resolving absolute or relative paths, usernames and passwords or drivers prefixes (“HDF5:”)- Parameters:
source – data source to decode, typically read from layer’s DOM element “datasource”
dataProvider – string identification of data provider (e.g. “ogr”), typically read from layer’s DOM element
context – reading context (e.g. for conversion between relative and absolute paths)
- Returns:
decoded source, typically to be used as the layer’s datasource
New in version 3.2.
- disconnectNotify(self, QMetaMethod)¶
- encodedSource(self, source: str, context: QgsReadWriteContext) str ¶
Called by
writeLayerXML()
, used by derived classes to encode provider’s specific data source to project files. Typically resolving absolute or relative paths, usernames and passwords or drivers prefixes (“HDF5:”)- Parameters:
source – data source to encode, typically
QgsMapLayer.source()
context – writing context (e.g. for conversion between relative and absolute paths)
- Returns:
encoded source, typically to be written in the DOM element “datasource”
New in version 3.2.
- hasDependencyCycle(self, Iterable[QgsMapLayerDependency]) bool ¶
Checks whether a new set of dependencies will introduce a cycle this method is now deprecated and always return
False
, because circular dependencies are now correctly managed.Deprecated since version QGIS: 3.10
- invalidateWgs84Extent(self)¶
Invalidates the WGS84 extent. If FlagTrustLayerMetadata is enabled, the extent is not invalidated because we want to trust metadata whatever happens.
New in version 3.20.
- isSignalConnected(self, QMetaMethod) bool ¶
- pluginLayerType(self) str ¶
Returns plugin layer type (the same as used in
QgsPluginLayerRegistry
)- Return type:
str
- readCommonStyle(self, layerElement: QDomElement, context: QgsReadWriteContext, categories: QgsMapLayer.StyleCategories | QgsMapLayer.StyleCategory = QgsMapLayer.AllStyleCategories)¶
Read style data common to all layer types
New in version 3.0.
- readCustomProperties(self, layerNode: QDomNode, keyStartsWith: str = '')¶
Read custom properties from project file.
- Parameters:
layerNode – note to read from
keyStartsWith – reads only properties starting with the specified string (or all if the string is empty)
- readStyleManager(self, layerNode: QDomNode)¶
Read style manager’s configuration (if any). To be called by subclasses.
- readXml(self, layer_node: QDomNode, context: QgsReadWriteContext) bool ¶
Called by
readLayerXML()
, used by children to read state specific to them from project files.
- receivers(self, PYQT_SIGNAL) int ¶
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setExtent(self, extent: QgsRectangle)¶
Sets extent of the layer
- Parameters:
extent (QgsRectangle) –
- setProviderType(self, providerType: str)¶
Sets the
providerType
(provider key)
- setSource(self, source: str)¶
Set source string. This is used for example in layer tree to show tooltip.
New in version 2.16.
- Parameters:
source (str) –
- setValid(self, valid: bool)¶
Sets whether layer is valid or not
- timerEvent(self, QTimerEvent)¶
- writeCommonStyle(self, layerElement: QDomElement, document: QDomDocument, context: QgsReadWriteContext, categories: QgsMapLayer.StyleCategories | QgsMapLayer.StyleCategory = QgsMapLayer.AllStyleCategories)¶
Write style data common to all layer types
New in version 3.0.
- writeCustomProperties(self, layerNode: QDomNode, doc: QDomDocument)¶
Write custom properties to project file.
- writeStyleManager(self, layerNode: QDomNode, doc: QDomDocument)¶
Write style manager’s configuration (if exists). To be called by subclasses.
- writeXml(self, layer_node: QDomNode, document: QDomDocument, context: QgsReadWriteContext) bool ¶
Called by
writeLayerXML()
, used by children to write state specific to them to project files.