Class: QgsLayerTreeRegistryBridge¶
Listens to layer changes from a QgsProject and applies
changes to a QgsLayerTree.
When connected to a layer tree, any layers added to the map layer registry will be also added to the layer tree. Similarly, map layers that are removed from registry will be removed from the layer tree.
If a layer is completely removed from the layer tree, it will be also removed from the map layer registry.
Class Hierarchy¶
Base classes¶
- class qgis.core.QgsLayerTreeRegistryBridge[source]¶
Bases:
QObject- __init__(root: QgsLayerTreeGroup | None, project: QgsProject | None, parent: QObject | None = None)
Create the instance that synchronizes given project with a layer tree root
- Parameters:
root (Optional[QgsLayerTreeGroup])
project (Optional[QgsProject])
parent (Optional[QObject] = None)
- class InsertionPoint¶
Bases:
objectA structure to define the insertion point to the layer tree. This represents the current layer tree group and index where newly added map layers should be inserted into.
Added in version 3.10.
- group¶
- position¶
- signal addedLayersToLayerTree[source]¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- groupWillRemoveChildren(self, node: QgsLayerTreeNode | None, indexFrom: int, indexTo: int)[source]¶
- Parameters:
node (Optional[QgsLayerTreeNode])
indexFrom (int)
indexTo (int)
- layerInsertionMethod(self) Qgis.LayerTreeInsertionMethod[source]¶
Returns the insertion method used to add layers to the tree
Added in version 3.30.
- Return type:
- layerInsertionPoint(self) QgsLayerTreeRegistryBridge.InsertionPoint[source]¶
Returns the insertion point used to add layers to the tree
Added in version 3.42.
- Return type:
- layersAdded(self, layers: Iterable[QgsMapLayer])[source]¶
- Parameters:
layers (Iterable[QgsMapLayer])
- layersWillBeRemoved(self, layerIds: Iterable[str | None])[source]¶
- Parameters:
layerIds (Iterable[Optional[str]])
- removeLayersFromRegistry(self, layerIds: Iterable[str | None])[source]¶
- Parameters:
layerIds (Iterable[Optional[str]])
- setLayerInsertionMethod(self, method: Qgis.LayerTreeInsertionMethod)[source]¶
Sets the insertion
methodused to add layers to the treeAdded in version 3.30.
- Parameters:
method (Qgis.LayerTreeInsertionMethod)
- setLayerInsertionPoint(self, parentGroup: QgsLayerTreeGroup | None, index: int)[source]¶
Set where the new layers should be inserted - can be used to follow current selection. By default it is root group with zero index.
Deprecated since version 3.10: Use setLayerInsertionPoint( const InsertionPoint &insertionPoint ) instead.
setLayerInsertionPoint(self, insertionPoint: QgsLayerTreeRegistryBridge.InsertionPoint) Set where the new layers should be inserted - can be used to follow current selection. By default it is root group with zero index.
Added in version 3.10.
- Parameters:
parentGroup (Optional[QgsLayerTreeGroup])
index (int)