Class: QgsLayerTreeViewDefaultActions

class qgis.gui.QgsLayerTreeViewDefaultActions

Bases: PyQt5.QtCore.QObject

The QgsLayerTreeViewDefaultActions class serves as a factory of actions that can be used together with a layer tree view.

See also

QgsLayerTreeView

Methods

actionAddGroup

param parent:

actionCheckAndAllChildren

Action to check a group and all its children

actionCheckAndAllParents

Action to check a group and all its parents

actionGroupSelected

param parent:

actionMakeTopLevel

Deprecated since version QGIS: 3.2

actionMoveOutOfGroup

See also

moveOutOfGroup()

actionMoveToBottom

See also

moveToBottom()

actionMoveToTop

See also

moveToTop()

actionMutuallyExclusiveGroup

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

actionRemoveGroupOrLayer

param parent:

actionRenameGroupOrLayer

param parent:

actionShowFeatureCount

param parent:

actionShowInOverview

param parent:

actionUncheckAndAllChildren

Action to uncheck a group and all its children

actionZoomToGroup

param canvas:

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

childEvent

connectNotify

customEvent

disconnectNotify

groupSelected

isSignalConnected

makeTopLevel

Deprecated since version QGIS: 3.2

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

receivers

removeGroupOrLayer

renameGroupOrLayer

sender

senderSignalIndex

showFeatureCount

showInOverview

timerEvent

uniqueGroupName

param parentGroup:

zoomToGroup

param canvas:

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

actionAddGroup(self, parent: QObject | None = None) QAction | None
Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionCheckAndAllChildren(self, parent: QObject | None = None) QAction | None

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

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

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionMakeTopLevel(self, parent: QObject | None = None) QAction | None

Deprecated since version QGIS: 3.2 use actionMoveOutOfGroup()

Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

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

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

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

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

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

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

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

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

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

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionShowInOverview(self, parent: QObject | None = None) QAction | None
Parameters:

parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionUncheckAndAllChildren(self, parent: QObject | None = None) QAction | None

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
Parameters:
  • canvas (Optional[QgsMapCanvas])

  • parent (Optional[QObject] = None)

Return type:

Optional[QAction]

actionZoomToLayer(self, canvas: QgsMapCanvas | None, parent: QObject | None = None) QAction | None

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

Deprecated since version QGIS: 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

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

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)
childEvent(self, a0: QChildEvent | None)
connectNotify(self, signal: QMetaMethod)
customEvent(self, a0: QEvent | None)
disconnectNotify(self, signal: QMetaMethod)
groupSelected(self)
isSignalConnected(self, signal: QMetaMethod) bool
makeTopLevel(self)

Deprecated since version QGIS: 3.2 use moveOutOfGroup()

moveOutOfGroup(self)

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

Added in version 3.2.

moveToBottom(self)

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)

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)

Slot to enable/disable mutually exclusive group flag

receivers(self, signal: PYQT_SIGNAL) int
removeGroupOrLayer(self)
renameGroupOrLayer(self)
sender(self) QObject | None
senderSignalIndex(self) int
showFeatureCount(self)
showInOverview(self)
timerEvent(self, a0: QTimerEvent | None)
uniqueGroupName(self, parentGroup: QgsLayerTreeGroup | None) str
Parameters:

parentGroup (Optional[QgsLayerTreeGroup])

Return type:

str

zoomToGroup(self, canvas: QgsMapCanvas | None)
zoomToGroup(self) None
Parameters:

canvas (Optional[QgsMapCanvas])

zoomToLayer(self, canvas: QgsMapCanvas | None)

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

Deprecated since version QGIS: 3.18 use zoomToLayers()

zoomToLayer(self) Zooms to the extent of the active layer in the layer tree.

Deprecated since version QGIS: 3.18 use zoomToLayers()

Parameters:

canvas (Optional[QgsMapCanvas])

zoomToLayers(self, canvas: QgsMapCanvas | None)

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

See also

zoomToLayers()

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)

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])