Class: QgsGroupLayer¶
A map layer which consists of a set of child layers, where all component layers are rendered as a single flattened object during map renders.
Child layers are never owned by QgsGroupLayer
. References to
layers in a group are stored as weak references only, which wills be
automatically cleaned up whenever the linked child layer is deleted.
Added in version 3.24.
Class Hierarchy¶
Base classes¶
Base class for all map layer types. |
|
Methods
Returns the child layers contained by the group. |
|
Returns the current paint effect for the group layer. |
|
Prepares all child layers in the group prior to removal from the group. |
|
Sets the child layers contained by the group. |
|
Sets the current paint effect for the renderer. |
- class qgis.core.QgsGroupLayer[source]¶
Bases:
QgsMapLayer
- __init__(name: str | None, options: QgsGroupLayer.LayerOptions)
Constructor for a new QgsGroupLayer with the specified layer
name
.The
options
argument specifies load-time layer options.- Parameters:
name (Optional[str])
options (QgsGroupLayer.LayerOptions)
- class LayerOptions¶
Bases:
object
Setting options for loading group layers.
Added in version 3.16.
- childLayers(self) List[QgsMapLayer] ¶
Returns the child layers contained by the group.
See also
- Return type:
List[QgsMapLayer]
- paintEffect(self) QgsPaintEffect | None [source]¶
Returns the current paint effect for the group layer.
See also
- Return type:
Optional[QgsPaintEffect]
- prepareLayersForRemovalFromGroup(self)[source]¶
Prepares all child layers in the group prior to removal from the group.
This method should be called before removing a group layer from a project, to ensure that the existing child layers are in a state which is compatible with non-group layer children.
Added in version 3.30.
- setChildLayers(self, layers: Iterable[QgsMapLayer])[source]¶
Sets the child
layers
contained by the group.This method does not take ownership of the layers, but rather assigns them to the group. Layers should be already added to the parent
QgsProject
wherever appropriate.See also
- Parameters:
layers (Iterable[QgsMapLayer])
- setPaintEffect(self, effect: QgsPaintEffect | None)[source]¶
Sets the current paint
effect
for the renderer.Ownership is transferred to the renderer.
See also
- Parameters:
effect (Optional[QgsPaintEffect])