Class: QgsLayerTreeViewDefaultActions¶
Serves as a factory of actions that can be used together with a layer tree view.
See also
Class Hierarchy¶
Base classes¶
- class qgis.gui.QgsLayerTreeViewDefaultActions[source]¶
Bases:
QObject- __init__(view: QgsLayerTreeViewBase | None)
Constructor for QgsLayerTreeViewDefaultActions, creating actions for a
view.The object will be parented to the specified
view.- Parameters:
view (Optional[QgsLayerTreeViewBase])
- actionAddGroup(self, parent: QObject | None = None) QAction | None[source]¶
Returns a new action which adds a group.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionCheckAndAllChildren(self, parent: QObject | None = None) QAction | None[source]¶
Action to check a group and all its children
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionCheckAndAllParents(self, parent: QObject | None = None) QAction | None[source]¶
Action to check a group and all its parents
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionGroupSelected(self, parent: QObject | None = None) QAction | None[source]¶
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionMakeTopLevel(self, parent: QObject | None = None) QAction | None[source]¶
Deprecated since version 3.2.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionMoveOutOfGroup(self, parent: QObject | None = None) QAction | None[source]¶
See also
Added in version 3.2.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionMoveToBottom(self, parent: QObject | None = None) QAction | None[source]¶
See also
Added in version 3.14.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionMoveToTop(self, parent: QObject | None = None) QAction | None[source]¶
See also
Added in version 3.2.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionMutuallyExclusiveGroup(self, parent: QObject | None = None) QAction | None[source]¶
Action to enable/disable mutually exclusive flag of a group (only one child node may be checked)
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionRemoveGroupOrLayer(self, parent: QObject | None = None) QAction | None[source]¶
Returns a new action which removes either a group or layer, depending on the selected node.
If a group is removed, all children for that group will also be removed.
See also
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionRemoveGroupPromoteLayers(self, parent: QObject | None = None) QAction | None[source]¶
Returns a new action which removes a group.
Any existing children in the group will be moved up to the parent of the removed group.
See also
Added in version 4.0.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionRenameGroupOrLayer(self, parent: QObject | None = None) QAction | None[source]¶
Returns a new action for renaming a group or layer, depending on the selected node.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionShowFeatureCount(self, parent: QObject | None = None) QAction | None[source]¶
Returns a new action for toggling whether the feature count is shown for a layer.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionShowInOverview(self, parent: QObject | None = None) QAction | None[source]¶
Returns a new action for toggling whether a layer is shown in the map overview.
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionUncheckAndAllChildren(self, parent: QObject | None = None) QAction | None[source]¶
Action to uncheck a group and all its children
- Parameters:
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionZoomToGroup(self, canvas: QgsMapCanvas | None, parent: QObject | None = None) QAction | None[source]¶
- Parameters:
canvas (Optional[QgsMapCanvas])
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionZoomToLayer(self, canvas: QgsMapCanvas | None, parent: QObject | None = None) QAction | None[source]¶
Action to zoom to the active layer from the layer tree.
Deprecated since version 3.18: Use
actionZoomToLayers().- Parameters:
canvas (Optional[QgsMapCanvas])
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionZoomToLayers(self, canvas: QgsMapCanvas | None, parent: QObject | None = None) QAction | None[source]¶
Action to zoom to all the selected layer(s) in the layer tree
Added in version 3.18.
- Parameters:
canvas (Optional[QgsMapCanvas])
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- actionZoomToSelection(self, canvas: QgsMapCanvas | None, parent: QObject | None = None) QAction | None[source]¶
Action to zoom to selected features of a vector layer
Added in version 3.2.
- Parameters:
canvas (Optional[QgsMapCanvas])
parent (Optional[QObject] = None)
- Return type:
Optional[QAction]
- makeTopLevel(self)[source]¶
Deprecated since version 3.2.
Use
moveOutOfGroup().
- moveOutOfGroup(self)[source]¶
Moves selected layer(s) out of the group(s) and places this/these above the group(s)
Added in version 3.2.
- moveToBottom(self)[source]¶
Moves selected layer(s) and/or group(s) to the bottom of the layer panel or the bottom of the group if the layer/group is placed within a group.
Added in version 3.14.
- moveToTop(self)[source]¶
Moves selected layer(s) and/or group(s) to the top of the layer panel or the top of the group if the layer/group is placed within a group.
Added in version 3.2.
- removeGroupPromoteLayers(self)[source]¶
Removes the selected group node, promoting all child nodes up into the removed group’s parent node.
Added in version 4.0.
- uniqueGroupName(self, parentGroup: QgsLayerTreeGroup | None) str[source]¶
- Parameters:
parentGroup (Optional[QgsLayerTreeGroup])
- Return type:
str
- zoomToGroup(self, canvas: QgsMapCanvas | None)[source]¶
- zoomToGroup(self)
- Parameters:
canvas (Optional[QgsMapCanvas])
- zoomToLayer(self, canvas: QgsMapCanvas | None)[source]¶
Zooms a map
canvasto the extent of the active layer in the layer tree.Deprecated since version 3.18: Use
zoomToLayers().zoomToLayer(self) Zooms to the extent of the active layer in the layer tree.
Deprecated since version 3.18: Use
zoomToLayers().- Parameters:
canvas (Optional[QgsMapCanvas])
- zoomToLayers(self, canvas: QgsMapCanvas | None)[source]¶
Zooms a map
canvasto all the selected layer(s) in the layer treeSee also
Added in version 3.18.
zoomToLayers(self) Zooms to the combined extent of all the selected layer(s) in the layer tree.
Added in version 3.18.
zoomToLayers(self, canvas: Optional[QgsMapCanvas], layers: Iterable[QgsMapLayer])
- Parameters:
canvas (Optional[QgsMapCanvas])
- zoomToSelection(self, canvas: QgsMapCanvas | None)[source]¶
See also
Added in version 3.2.
zoomToSelection(self) Zooms to the bounding box of all selected features of a vector layer.
Added in version 3.2.
- Parameters:
canvas (Optional[QgsMapCanvas])