Subgroup: Layer

Class: QgsLayerTreeMapCanvasBridge

class qgis.gui.QgsLayerTreeMapCanvasBridge

Bases: PyQt5.QtCore.QObject

The QgsLayerTreeMapCanvasBridge class takes care of updates of layer set for QgsMapCanvas from a layer tree. The class listens to the updates in the layer tree and updates the list of layers for rendering whenever some layers are added, removed, or their visibility changes.

The update of layers is not done immediately - it is postponed, so a series of updates to the layer tree will trigger just one update of canvas layers.

Also allows the client to override the default order of layers. This is useful in advanced cases where the grouping in layer tree should be independent from the actual order in the canvas.

New in version 2.4: Methods

autoSetupOnFirstLayer
blockSignals
childEvent
children
connectNotify
customEvent
deleteLater
disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
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]
inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
mapCanvas
metaObject
moveToThread
objectName
overviewCanvas Returns associated overview canvas (may be null)
parent
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
rootGroup
sender
senderSignalIndex
setAutoSetupOnFirstLayer if enabled, will automatically set full canvas extent and destination CRS + map units
setCanvasLayers force update of canvas layers from the layer tree. Normally this should not be needed to be called.
setObjectName
setOvervewCanvas Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated
setParent
setProperty
signalsBlocked
startTimer
thread
timerEvent
tr

Attributes

canvasLayersChanged Emitted when the set of layers (or order of layers) visible in the canvas changes.
destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
autoSetupOnFirstLayer(self) → bool
canvasLayersChanged

Emitted when the set of layers (or order of layers) visible in the canvas changes.

New in version 3.0: [signal]

childEvent()
connectNotify()
customEvent()
disconnectNotify()
isSignalConnected()
mapCanvas(self) → QgsMapCanvas
overviewCanvas(self) → QgsMapOverviewCanvas

Returns associated overview canvas (may be null)

New in version 3.0.

receivers()
rootGroup(self) → QgsLayerTree
sender()
senderSignalIndex()
setAutoSetupOnFirstLayer(self, enabled: bool)

if enabled, will automatically set full canvas extent and destination CRS + map units when first layer(s) are added

setCanvasLayers(self)

force update of canvas layers from the layer tree. Normally this should not be needed to be called.

setOvervewCanvas(self, overviewCanvas: QgsMapOverviewCanvas)

Associates overview canvas with the bridge, so the overview will be updated whenever main canvas is updated

New in version 3.0.

timerEvent()