Class: QgsLayerTreeViewDefaultActions

Serves as a factory of actions that can be used together with a layer tree view.

See also

QgsLayerTreeView

Class Hierarchy

Inheritance diagram of qgis.gui.QgsLayerTreeViewDefaultActions

Base classes

QObject

Methods

actionAddGroup

actionCheckAndAllChildren

Action to check a group and all its children

actionCheckAndAllParents

Action to check a group and all its parents

actionGroupSelected

actionMakeTopLevel

actionMoveOutOfGroup

actionMoveToBottom

actionMoveToTop

actionMutuallyExclusiveGroup

Action to enable/disable mutually exclusive flag of a group (only one child node may be checked)

actionRemoveGroupOrLayer

actionRenameGroupOrLayer

actionShowFeatureCount

actionShowInOverview

actionUncheckAndAllChildren

Action to uncheck a group and all its children

actionZoomToGroup

actionZoomToLayer

Action to zoom to the active layer from the layer tree.

actionZoomToLayers

Action to zoom to all the selected layer(s) in the layer tree

actionZoomToSelection

Action to zoom to selected features of a vector layer

addGroup

groupSelected

makeTopLevel

moveOutOfGroup

Moves selected layer(s) out of the group(s) and places this/these above the group(s)

moveToBottom

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.

moveToTop

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.

mutuallyExclusiveGroup

Slot to enable/disable mutually exclusive group flag

removeGroupOrLayer

renameGroupOrLayer

showFeatureCount

showInOverview

uniqueGroupName

zoomToGroup

zoomToLayer

Zooms a map canvas to the extent of the active layer in the layer tree.

zoomToLayers

Zooms a map canvas to all the selected layer(s) in the layer tree

zoomToSelection

class qgis.gui.QgsLayerTreeViewDefaultActions[source]

Bases: QObject

actionAddGroup(self, parent: QObject | None = None) QAction | None[source]
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.

Use actionMoveOutOfGroup().

Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionMoveOutOfGroup(self, parent: QObject | None = None) QAction | None[source]

See also

moveOutOfGroup()

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

moveToBottom()

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

moveToTop()

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]
Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionRenameGroupOrLayer(self, parent: QObject | None = None) QAction | None[source]
Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionShowFeatureCount(self, parent: QObject | None = None) QAction | None[source]
Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionShowInOverview(self, parent: QObject | None = None) QAction | None[source]
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]

addGroup(self)[source]
groupSelected(self)[source]
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.

mutuallyExclusiveGroup(self)[source]

Slot to enable/disable mutually exclusive group flag

removeGroupOrLayer(self)[source]
renameGroupOrLayer(self)[source]
showFeatureCount(self)[source]
showInOverview(self)[source]
uniqueGroupName(self, parentGroup: QgsLayerTreeGroup | None) str[source]
Parameters:

parentGroup (Optional[QgsLayerTreeGroup])

Return type:

str

zoomToGroup(self, canvas: QgsMapCanvas | None)[source]
zoomToGroup(self) None
Parameters:

canvas (Optional[QgsMapCanvas])

zoomToGroup(self)[source]
zoomToLayer(self, canvas: QgsMapCanvas | None)[source]

Zooms a map canvas to the extent of the active layer in the layer tree.

Deprecated since version 3.18: Use zoomToLayers().

Parameters:

canvas (Optional[QgsMapCanvas])

zoomToLayer(self)[source]

Zooms to the extent of the active layer in the layer tree.

Deprecated since version 3.18: Use zoomToLayers().

zoomToLayers(self, canvas: QgsMapCanvas | None)[source]

Zooms a map canvas to all the selected layer(s) in the layer tree

See also

zoomToLayers()

Added in version 3.18.

Parameters:

canvas (Optional[QgsMapCanvas])

zoomToLayers(self)[source]

Zooms to the combined extent of all the selected layer(s) in the layer tree.

Added in version 3.18.

zoomToLayers(self, canvas: QgsMapCanvas | None, layers: Iterable[QgsMapLayer])[source]
Parameters:
zoomToSelection(self, canvas: QgsMapCanvas | None)[source]

Added in version 3.2.

Parameters:

canvas (Optional[QgsMapCanvas])

zoomToSelection(self)[source]

Zooms to the bounding box of all selected features of a vector layer.

Added in version 3.2.