QGIS API Documentation 3.99.0-Master (21b3aa880ba)
Loading...
Searching...
No Matches
QgsLayerTreeViewDefaultActions Class Reference

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

#include <qgslayertreeviewdefaultactions.h>

Inheritance diagram for QgsLayerTreeViewDefaultActions:

Public Slots

void addGroup ()
void showInOverview ()

Public Member Functions

 QgsLayerTreeViewDefaultActions (QgsLayerTreeViewBase *view)
 Constructor for QgsLayerTreeViewDefaultActions, creating actions for a view.
QAction * actionAddGroup (QObject *parent=nullptr)
 Returns a new action which adds a group.
QAction * actionCheckAndAllChildren (QObject *parent=nullptr)
 Action to check a group and all its children.
QAction * actionCheckAndAllParents (QObject *parent=nullptr)
 Action to check a group and all its parents.
QAction * actionGroupSelected (QObject *parent=nullptr)
Q_DECL_DEPRECATED QAction * actionMakeTopLevel (QObject *parent=nullptr)
QAction * actionMoveOutOfGroup (QObject *parent=nullptr)
QAction * actionMoveToBottom (QObject *parent=nullptr)
QAction * actionMoveToTop (QObject *parent=nullptr)
QAction * actionMutuallyExclusiveGroup (QObject *parent=nullptr)
 Action to enable/disable mutually exclusive flag of a group (only one child node may be checked).
QAction * actionRemoveGroupOrLayer (QObject *parent=nullptr)
 Returns a new action which removes either a group or layer, depending on the selected node.
QAction * actionRemoveGroupPromoteLayers (QObject *parent=nullptr)
 Returns a new action which removes a group.
QAction * actionRenameGroupOrLayer (QObject *parent=nullptr)
 Returns a new action for renaming a group or layer, depending on the selected node.
QAction * actionShowFeatureCount (QObject *parent=nullptr)
 Returns a new action for toggling whether the feature count is shown for a layer.
QAction * actionShowInOverview (QObject *parent=nullptr)
 Returns a new action for toggling whether a layer is shown in the map overview.
QAction * actionUncheckAndAllChildren (QObject *parent=nullptr)
 Action to uncheck a group and all its children.
QAction * actionZoomToGroup (QgsMapCanvas *canvas, QObject *parent=nullptr)
Q_DECL_DEPRECATED QAction * actionZoomToLayer (QgsMapCanvas *canvas, QObject *parent=nullptr)
 Action to zoom to the active layer from the layer tree.
QAction * actionZoomToLayers (QgsMapCanvas *canvas, QObject *parent=nullptr)
 Action to zoom to all the selected layer(s) in the layer tree.
QAction * actionZoomToSelection (QgsMapCanvas *canvas, QObject *parent=nullptr)
 Action to zoom to selected features of a vector layer.
void zoomToGroup (QgsMapCanvas *canvas)
Q_DECL_DEPRECATED void zoomToLayer (QgsMapCanvas *canvas)
 Zooms a map canvas to the extent of the active layer in the layer tree.
void zoomToLayers (QgsMapCanvas *canvas)
 Zooms a map canvas to all the selected layer(s) in the layer tree.
void zoomToSelection (QgsMapCanvas *canvas)

Protected Slots

void groupSelected ()
Q_DECL_DEPRECATED void makeTopLevel ()
void moveOutOfGroup ()
 Moves selected layer(s) out of the group(s) and places this/these above the group(s).
void 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.
void 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.
void mutuallyExclusiveGroup ()
 Slot to enable/disable mutually exclusive group flag.
void removeGroupOrLayer ()
void removeGroupPromoteLayers ()
 Removes the selected group node, promoting all child nodes up into the removed group's parent node.
void renameGroupOrLayer ()
void showFeatureCount ()
void zoomToGroup ()
Q_DECL_DEPRECATED void zoomToLayer ()
 Zooms to the extent of the active layer in the layer tree.
void zoomToLayers ()
 Zooms to the combined extent of all the selected layer(s) in the layer tree.
void zoomToSelection ()
 Zooms to the bounding box of all selected features of a vector layer.

Protected Member Functions

QString uniqueGroupName (QgsLayerTreeGroup *parentGroup)
void zoomToLayers (QgsMapCanvas *canvas, const QList< QgsMapLayer * > &layers)

Protected Attributes

QgsLayerTreeViewBasemView = nullptr

Detailed Description

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

See also
QgsLayerTreeView

Definition at line 38 of file qgslayertreeviewdefaultactions.h.

Constructor & Destructor Documentation

◆ QgsLayerTreeViewDefaultActions()

QgsLayerTreeViewDefaultActions::QgsLayerTreeViewDefaultActions ( QgsLayerTreeViewBase * view)

Constructor for QgsLayerTreeViewDefaultActions, creating actions for a view.

The object will be parented to the specified view.

Definition at line 31 of file qgslayertreeviewdefaultactions.cpp.

Member Function Documentation

◆ actionAddGroup()

QAction * QgsLayerTreeViewDefaultActions::actionAddGroup ( QObject * parent = nullptr)

Returns a new action which adds a group.

Definition at line 37 of file qgslayertreeviewdefaultactions.cpp.

◆ actionCheckAndAllChildren()

QAction * QgsLayerTreeViewDefaultActions::actionCheckAndAllChildren ( QObject * parent = nullptr)

Action to check a group and all its children.

Definition at line 185 of file qgslayertreeviewdefaultactions.cpp.

◆ actionCheckAndAllParents()

QAction * QgsLayerTreeViewDefaultActions::actionCheckAndAllParents ( QObject * parent = nullptr)

Action to check a group and all its parents.

Definition at line 213 of file qgslayertreeviewdefaultactions.cpp.

◆ actionGroupSelected()

QAction * QgsLayerTreeViewDefaultActions::actionGroupSelected ( QObject * parent = nullptr)

Definition at line 165 of file qgslayertreeviewdefaultactions.cpp.

◆ actionMakeTopLevel()

QAction * QgsLayerTreeViewDefaultActions::actionMakeTopLevel ( QObject * parent = nullptr)
Deprecated
QGIS 3.2. Use actionMoveOutOfGroup().

Definition at line 135 of file qgslayertreeviewdefaultactions.cpp.

◆ actionMoveOutOfGroup()

QAction * QgsLayerTreeViewDefaultActions::actionMoveOutOfGroup ( QObject * parent = nullptr)
See also
moveOutOfGroup()
Since
QGIS 3.2

Definition at line 144 of file qgslayertreeviewdefaultactions.cpp.

◆ actionMoveToBottom()

QAction * QgsLayerTreeViewDefaultActions::actionMoveToBottom ( QObject * parent = nullptr)
See also
moveToBottom()
Since
QGIS 3.14

Definition at line 158 of file qgslayertreeviewdefaultactions.cpp.

◆ actionMoveToTop()

QAction * QgsLayerTreeViewDefaultActions::actionMoveToTop ( QObject * parent = nullptr)
See also
moveToTop()
Since
QGIS 3.2

Definition at line 151 of file qgslayertreeviewdefaultactions.cpp.

◆ actionMutuallyExclusiveGroup()

QAction * QgsLayerTreeViewDefaultActions::actionMutuallyExclusiveGroup ( QObject * parent = nullptr)

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

Definition at line 172 of file qgslayertreeviewdefaultactions.cpp.

◆ actionRemoveGroupOrLayer()

QAction * QgsLayerTreeViewDefaultActions::actionRemoveGroupOrLayer ( QObject * parent = nullptr)

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
actionRemoveGroupPromoteLayers()

Definition at line 44 of file qgslayertreeviewdefaultactions.cpp.

◆ actionRemoveGroupPromoteLayers()

QAction * QgsLayerTreeViewDefaultActions::actionRemoveGroupPromoteLayers ( QObject * parent = nullptr)

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
actionRemoveGroupOrLayer()
Since
QGIS 4.0

Definition at line 51 of file qgslayertreeviewdefaultactions.cpp.

◆ actionRenameGroupOrLayer()

QAction * QgsLayerTreeViewDefaultActions::actionRenameGroupOrLayer ( QObject * parent = nullptr)

Returns a new action for renaming a group or layer, depending on the selected node.

Definition at line 71 of file qgslayertreeviewdefaultactions.cpp.

◆ actionShowFeatureCount()

QAction * QgsLayerTreeViewDefaultActions::actionShowFeatureCount ( QObject * parent = nullptr)

Returns a new action for toggling whether the feature count is shown for a layer.

Definition at line 88 of file qgslayertreeviewdefaultactions.cpp.

◆ actionShowInOverview()

QAction * QgsLayerTreeViewDefaultActions::actionShowInOverview ( QObject * parent = nullptr)

Returns a new action for toggling whether a layer is shown in the map overview.

Definition at line 58 of file qgslayertreeviewdefaultactions.cpp.

◆ actionUncheckAndAllChildren()

QAction * QgsLayerTreeViewDefaultActions::actionUncheckAndAllChildren ( QObject * parent = nullptr)

Action to uncheck a group and all its children.

Definition at line 199 of file qgslayertreeviewdefaultactions.cpp.

◆ actionZoomToGroup()

QAction * QgsLayerTreeViewDefaultActions::actionZoomToGroup ( QgsMapCanvas * canvas,
QObject * parent = nullptr )

Definition at line 127 of file qgslayertreeviewdefaultactions.cpp.

◆ actionZoomToLayer()

QAction * QgsLayerTreeViewDefaultActions::actionZoomToLayer ( QgsMapCanvas * canvas,
QObject * parent = nullptr )

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

Deprecated
QGIS 3.18. Use actionZoomToLayers().

Definition at line 101 of file qgslayertreeviewdefaultactions.cpp.

◆ actionZoomToLayers()

QAction * QgsLayerTreeViewDefaultActions::actionZoomToLayers ( QgsMapCanvas * canvas,
QObject * parent = nullptr )

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

Since
QGIS 3.18

Definition at line 111 of file qgslayertreeviewdefaultactions.cpp.

◆ actionZoomToSelection()

QAction * QgsLayerTreeViewDefaultActions::actionZoomToSelection ( QgsMapCanvas * canvas,
QObject * parent = nullptr )

Action to zoom to selected features of a vector layer.

Since
QGIS 3.2

Definition at line 119 of file qgslayertreeviewdefaultactions.cpp.

◆ addGroup

void QgsLayerTreeViewDefaultActions::addGroup ( )
slot

Definition at line 247 of file qgslayertreeviewdefaultactions.cpp.

◆ groupSelected

void QgsLayerTreeViewDefaultActions::groupSelected ( )
protectedslot

Definition at line 542 of file qgslayertreeviewdefaultactions.cpp.

◆ makeTopLevel

void QgsLayerTreeViewDefaultActions::makeTopLevel ( )
protectedslot
Deprecated
QGIS 3.2. Use moveOutOfGroup().

Definition at line 469 of file qgslayertreeviewdefaultactions.cpp.

◆ moveOutOfGroup

void QgsLayerTreeViewDefaultActions::moveOutOfGroup ( )
protectedslot

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

Since
QGIS 3.2

Definition at line 485 of file qgslayertreeviewdefaultactions.cpp.

◆ moveToBottom

void QgsLayerTreeViewDefaultActions::moveToBottom ( )
protectedslot

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.

Since
QGIS 3.14

Definition at line 525 of file qgslayertreeviewdefaultactions.cpp.

◆ moveToTop

void QgsLayerTreeViewDefaultActions::moveToTop ( )
protectedslot

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.

Since
QGIS 3.2

Definition at line 507 of file qgslayertreeviewdefaultactions.cpp.

◆ mutuallyExclusiveGroup

void QgsLayerTreeViewDefaultActions::mutuallyExclusiveGroup ( )
protectedslot

Slot to enable/disable mutually exclusive group flag.

Definition at line 568 of file qgslayertreeviewdefaultactions.cpp.

◆ removeGroupOrLayer

void QgsLayerTreeViewDefaultActions::removeGroupOrLayer ( )
protectedslot

Definition at line 263 of file qgslayertreeviewdefaultactions.cpp.

◆ removeGroupPromoteLayers

void QgsLayerTreeViewDefaultActions::removeGroupPromoteLayers ( )
protectedslot

Removes the selected group node, promoting all child nodes up into the removed group's parent node.

Since
QGIS 4.0

Definition at line 273 of file qgslayertreeviewdefaultactions.cpp.

◆ renameGroupOrLayer

void QgsLayerTreeViewDefaultActions::renameGroupOrLayer ( )
protectedslot

Definition at line 300 of file qgslayertreeviewdefaultactions.cpp.

◆ showFeatureCount

void QgsLayerTreeViewDefaultActions::showFeatureCount ( )
protectedslot

Definition at line 316 of file qgslayertreeviewdefaultactions.cpp.

◆ showInOverview

void QgsLayerTreeViewDefaultActions::showInOverview ( )
slot

Definition at line 305 of file qgslayertreeviewdefaultactions.cpp.

◆ uniqueGroupName()

QString QgsLayerTreeViewDefaultActions::uniqueGroupName ( QgsLayerTreeGroup * parentGroup)
protected

Definition at line 459 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToGroup [1/2]

void QgsLayerTreeViewDefaultActions::zoomToGroup ( )
protectedslot

Definition at line 395 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToGroup() [2/2]

void QgsLayerTreeViewDefaultActions::zoomToGroup ( QgsMapCanvas * canvas)

Definition at line 357 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToLayer [1/2]

void QgsLayerTreeViewDefaultActions::zoomToLayer ( )
protectedslot

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

Deprecated
QGIS 3.18. Use zoomToLayers().

Definition at line 371 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToLayer() [2/2]

void QgsLayerTreeViewDefaultActions::zoomToLayer ( QgsMapCanvas * canvas)

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

Deprecated
QGIS 3.18. Use zoomToLayers().

Definition at line 328 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToLayers [1/3]

void QgsLayerTreeViewDefaultActions::zoomToLayers ( )
protectedslot

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

Since
QGIS 3.18

Definition at line 381 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToLayers() [2/3]

void QgsLayerTreeViewDefaultActions::zoomToLayers ( QgsMapCanvas * canvas)

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

See also
zoomToLayers()
Since
QGIS 3.18

Definition at line 338 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToLayers() [3/3]

void QgsLayerTreeViewDefaultActions::zoomToLayers ( QgsMapCanvas * canvas,
const QList< QgsMapLayer * > & layers )
protected

Definition at line 402 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToSelection [1/2]

void QgsLayerTreeViewDefaultActions::zoomToSelection ( )
protectedslot

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

Since
QGIS 3.2

Definition at line 388 of file qgslayertreeviewdefaultactions.cpp.

◆ zoomToSelection() [2/2]

void QgsLayerTreeViewDefaultActions::zoomToSelection ( QgsMapCanvas * canvas)
See also
zoomToSelection()
Since
QGIS 3.2

Definition at line 345 of file qgslayertreeviewdefaultactions.cpp.

Member Data Documentation

◆ mView

QgsLayerTreeViewBase* QgsLayerTreeViewDefaultActions::mView = nullptr
protected

Definition at line 246 of file qgslayertreeviewdefaultactions.h.


The documentation for this class was generated from the following files: