Subgroup: Layer

Class: QgsLayerItem

class qgis.core.QgsLayerItem

Bases: qgis._core.QgsDataItem

Item that represents a layer that can be opened with one of the providers

Methods

acceptDrop Returns whether the item accepts drag and dropped layers - e.g.
actions Returns the list of actions available for this item.
addChildItem Inserts a new child item.
blockSignals
capabilities2
childEvent
children
childrenCreated
comments Returns comments of the layer
connectNotify
createChildren Create children.
customEvent
deferredDelete
deleteChildItem Removes and deletes a child item, emitting relevant signals to the model.
deleteLater deleteLater(self)
depopulate Remove children recursively and set as not populated.
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
equal
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
findItem
handleDoubleClick Called when a user double clicks on the item.
handleDrop Attempts to process the mime data dropped on this item.
hasChildren
hasDragEnabled
icon
iconDefault
iconLine
iconName Returns the icon name of the given layerType
iconPoint
iconPolygon
iconRaster
iconTable
inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
layerName
return:the layer name
layerTypeAsString Returns the string representation of the given layerType
mapLayerType Returns QgsMapLayer.LayerType
menus Returns the list of menus available for this item.
metaObject
mimeUri
moveToThread Move object and all its descendants to thread
name Returns the name of the item (the displayed text for the item).
objectName
paramWidget
parent Get item parent.
path
pathComponent Create path component replacing path separators
populate
property
providerKey Returns provider key
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
refresh
refreshConnections Refresh connections: update GUI and emit signal
removeChildItem Removes a child item and returns it without deleting it.
removeEventFilter
rowCount
sender
senderSignalIndex
setCapabilities Sets the capabilities for the data item.
setCrs Writes the selected crs into data source.
setIcon
setIconName
setName Sets the name of the item (the displayed text for the item).
setObjectName
setParent Set item parent and connect / disconnect parent to / from item signals.
setPath
setProperty
setSortKey Sets a custom sorting key for the item.
setState Set item state.
setToolTip
signalsBlocked
sortKey Returns the sorting key for the item.
startTimer
state

New in version 2.8.

supportedCrs Returns the supported CRS
supportedFormats Returns the supported formats
thread
timerEvent
toolTip
tr
type
updateIcon
uri Returns layer uri or empty string if layer cannot be created

Attributes

Collapse
Collection
Custom
Database
Directory
Error
Fast
Favorites
Fertile
Layer
Line
NoCapabilities
NoType
NotPopulated
Plugin
Point
Polygon
Populated
Populating
Project
Raster
SetCrs
Table
TableLayer
Vector
beginInsertItems beginInsertItems(self, QgsDataItem, int, int) [signal]
beginRemoveItems beginRemoveItems(self, QgsDataItem, int, int) [signal]
connectionsChanged Emitted when the provider’s connections of the child items have changed
dataChanged dataChanged(self, QgsDataItem) [signal]
destroyed destroyed(self, QObject = None) [signal]
endInsertItems endInsertItems(self) [signal]
endRemoveItems endRemoveItems(self) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
stateChanged stateChanged(self, QgsDataItem, QgsDataItem.State) [signal]
staticMetaObject
Database = 7
class LayerType

Bases: int

Line = 4
NoType = 0
Plugin = 9
Point = 3
Polygon = 5
Raster = 2
Table = 8
TableLayer = 6
Vector = 1
childEvent()
comments(self) → str

Returns comments of the layer

New in version 2.12.

connectNotify()
customEvent()
deferredDelete()
disconnectNotify()
equal(self, other: QgsDataItem) → bool
hasDragEnabled(self) → bool
iconDefault() → QIcon
iconLine() → QIcon
iconName(layerType: QgsLayerItem.LayerType) → str

Returns the icon name of the given layerType

New in version 3.

iconPoint() → QIcon
iconPolygon() → QIcon
iconRaster() → QIcon
iconTable() → QIcon
isSignalConnected()
layerName(self) → str
Returns:the layer name
layerTypeAsString(layerType: QgsLayerItem.LayerType) → str

Returns the string representation of the given layerType

New in version 3.

mapLayerType(self) → QgsMapLayer.LayerType

Returns QgsMapLayer.LayerType

mimeUri(self) → QgsMimeDataUtils.Uri
populate()
providerKey(self) → str

Returns provider key

receivers()
refresh()
sender()
senderSignalIndex()
supportedCrs(self) → List[str]

Returns the supported CRS

New in version 2.8.

supportedFormats(self) → List[str]

Returns the supported formats

New in version 2.8.

timerEvent()
updateIcon()
uri(self) → str

Returns layer uri or empty string if layer cannot be created