Class: QgsLayerItem¶
- class qgis.core.QgsLayerItem¶
Bases:
QgsDataItem
Item that represents a layer that can be opened with one of the providers
QgsLayerItem(parent:
QgsDataItem
, name: str, path: str, uri: str, layerType: Qgis.BrowserLayerType, providerKey: str) Constructor for QgsLayerItem.Enums
alias of
BrowserLayerType
Methods
Returns comments of the layer
- rtype:
QgsAbstractDatabaseProviderConnection
The item is scheduled to be deleted.
Delete this layer item Use
QgsDataItemGuiProvider
.deleteLayer instead- param other:
- rtype:
bool
- rtype:
QIcon
Returns the icon for a vector layer whose geometry type is provided.
- rtype:
QIcon
Returns icon for mesh layer type
Returns the icon name of the given
layerType
- rtype:
QIcon
Returns icon for point cloud layer
- rtype:
QIcon
- rtype:
QIcon
- rtype:
QIcon
Returns icon for vector tile layer
Returns layer's metadata, it may be a default constructed metadata if metadata is not explicitly set.
- rtype:
str
Returns the string representation of the given
layerType
Returns the associated map layer type.
- rtype:
List[QgsMimeDataUtils.Uri]
Returns provider key
Refresh the items from a specified list of child items.
Set layer's
metadata
.Returns the supported CRS
Returns the supported formats
Returns the layer item type corresponding to a
QgsMapLayer
layer
.Will request a repaint of this icon.
Returns layer uri or empty string if layer cannot be created
- LayerType¶
alias of
BrowserLayerType
- childEvent(self, QChildEvent)¶
- comments(self) str ¶
Returns comments of the layer
- Return type:
str
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- databaseConnection(self) QgsAbstractDatabaseProviderConnection ¶
- Return type:
- deferredDelete(self) bool ¶
The item is scheduled to be deleted. E.g. if
deleteLater()
is called when item is in Populating state (createChildren()
running in another thread), thedeferredDelete()
returnsTrue
and item will be deleted once Populating finished. Items with slowreateChildren()
(for example network or database based) may check duringcreateChildren()
ifdeferredDelete()
returnsTrue
and return fromcreateChildren()
immediately because result will be useless.
- deleteLayer(self) bool ¶
Delete this layer item Use
QgsDataItemGuiProvider
.deleteLayer insteadDeprecated since version QGIS: 3.10
- Return type:
bool
- disconnectNotify(self, QMetaMethod)¶
- equal(self, other: QgsDataItem) bool ¶
- Parameters:
other (QgsDataItem) –
- Return type:
bool
- hasDragEnabled(self) bool ¶
- Return type:
bool
- iconDefault() QIcon ¶
- Return type:
QIcon
- iconForWkbType(type: Qgis.WkbType) QIcon ¶
Returns the icon for a vector layer whose geometry type is provided.
New in version 3.18.
- Parameters:
type (Qgis.WkbType) –
- Return type:
QIcon
- iconLine() QIcon ¶
- Return type:
QIcon
- iconMesh() QIcon ¶
Returns icon for mesh layer type
- Return type:
QIcon
- iconName(layerType: Qgis.BrowserLayerType) str ¶
Returns the icon name of the given
layerType
New in version 3.
- Parameters:
layerType (Qgis.BrowserLayerType) –
- Return type:
str
- iconPoint() QIcon ¶
- Return type:
QIcon
- iconPointCloud() QIcon ¶
Returns icon for point cloud layer
- Return type:
QIcon
- iconPolygon() QIcon ¶
- Return type:
QIcon
- iconRaster() QIcon ¶
- Return type:
QIcon
- iconTable() QIcon ¶
- Return type:
QIcon
- iconVectorTile() QIcon ¶
Returns icon for vector tile layer
- Return type:
QIcon
- isSignalConnected(self, QMetaMethod) bool ¶
- layerMetadata(self) QgsLayerMetadata ¶
Returns layer’s metadata, it may be a default constructed metadata if metadata is not explicitly set.
New in version 3.28.
- Return type:
- layerName(self) str ¶
- Return type:
str
- Returns:
the layer name
- layerTypeAsString(layerType: Qgis.BrowserLayerType) str ¶
Returns the string representation of the given
layerType
New in version 3.
- Parameters:
layerType (Qgis.BrowserLayerType) –
- Return type:
str
- mapLayerType(self) Qgis.LayerType ¶
Returns the associated map layer type.
- Return type:
- mimeUris(self) List[QgsMimeDataUtils.Uri] ¶
- Return type:
List[QgsMimeDataUtils.Uri]
- populate(self, children: Iterable[QgsDataItem])¶
- populate(self, foreground: bool = False) None
- providerKey(self) str ¶
Returns provider key
- Return type:
str
- receivers(self, PYQT_SIGNAL) int ¶
- refresh(self, children: Iterable[QgsDataItem])¶
Refresh the items from a specified list of child items.
refresh(self)
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setLayerMetadata(self, metadata: QgsLayerMetadata)¶
Set layer’s
metadata
.New in version 3.28.
- Parameters:
metadata (QgsLayerMetadata) –
- supportedCrs(self) List[str] ¶
Returns the supported CRS
- Return type:
List[str]
- supportedFormats(self) List[str] ¶
Returns the supported formats
- Return type:
List[str]
- timerEvent(self, QTimerEvent)¶
- typeFromMapLayer(layer: QgsMapLayer) Qgis.BrowserLayerType ¶
Returns the layer item type corresponding to a
QgsMapLayer
layer
.New in version 3.6.
- Parameters:
layer (QgsMapLayer) –
- Return type:
- updateIcon(self)¶
Will request a repaint of this icon.
- uri(self) str ¶
Returns layer uri or empty string if layer cannot be created
- Return type:
str