QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgslayertreeviewdefaultactions.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayertreeviewdefaultactions.h
3 --------------------------------------
4 Date : May 2014
5 Copyright : (C) 2014 by Martin Dobias
6 Email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSLAYERTREEVIEWDEFAULTACTIONS_H
17#define QGSLAYERTREEVIEWDEFAULTACTIONS_H
18
19#include "qgis.h"
20#include "qgis_gui.h"
21
22#include <QObject>
23
24class QAction;
25
28class QgsMapCanvas;
29class QgsMapLayer;
30
31
38class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
39{
40 Q_OBJECT
41 public:
48
52 QAction *actionAddGroup( QObject *parent = nullptr ) SIP_FACTORY;
53
61 QAction *actionRemoveGroupOrLayer( QObject *parent = nullptr ) SIP_FACTORY;
62
72 QAction *actionRemoveGroupPromoteLayers( QObject *parent = nullptr ) SIP_FACTORY;
73
77 QAction *actionShowInOverview( QObject *parent = nullptr ) SIP_FACTORY;
78
82 QAction *actionRenameGroupOrLayer( QObject *parent = nullptr ) SIP_FACTORY;
83
87 QAction *actionShowFeatureCount( QObject *parent = nullptr ) SIP_FACTORY;
88
90 QAction *actionCheckAndAllChildren( QObject *parent = nullptr );
91
93 QAction *actionUncheckAndAllChildren( QObject *parent = nullptr );
94
96 QAction *actionCheckAndAllParents( QObject *parent = nullptr );
97
102 Q_DECL_DEPRECATED QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY SIP_DEPRECATED;
103
108 QAction *actionZoomToLayers( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
109
114 QAction *actionZoomToSelection( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
115 QAction *actionZoomToGroup( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
116
120 Q_DECL_DEPRECATED QAction *actionMakeTopLevel( QObject *parent = nullptr ) SIP_FACTORY;
121
126 QAction *actionMoveOutOfGroup( QObject *parent = nullptr ) SIP_FACTORY;
127
132 QAction *actionMoveToTop( QObject *parent = nullptr ) SIP_FACTORY;
133
138 QAction *actionMoveToBottom( QObject *parent = nullptr ) SIP_FACTORY;
139 QAction *actionGroupSelected( QObject *parent = nullptr ) SIP_FACTORY;
140
144 QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;
145
150 Q_DECL_DEPRECATED void zoomToLayer( QgsMapCanvas *canvas ) SIP_DEPRECATED;
151
157 void zoomToLayers( QgsMapCanvas *canvas );
158
163 void zoomToSelection( QgsMapCanvas *canvas );
164 void zoomToGroup( QgsMapCanvas *canvas );
165
166 public slots:
167 void showInOverview();
168 void addGroup();
169
170 protected slots:
171 void removeGroupOrLayer();
172
180
181 void renameGroupOrLayer();
182 void showFeatureCount();
183
188 Q_DECL_DEPRECATED void zoomToLayer() SIP_DEPRECATED;
189
194 void zoomToLayers();
195
200 void zoomToSelection();
201 void zoomToGroup();
202
206 Q_DECL_DEPRECATED void makeTopLevel() SIP_DEPRECATED;
207
212 void moveOutOfGroup();
213
219 void moveToTop();
220
226 void moveToBottom();
227 void groupSelected();
228
233
234 private slots:
235 void checkAndAllChildren();
236 void uncheckAndAllChildren();
237 void checkAndAllParents();
238
239 protected:
240 void zoomToLayers( QgsMapCanvas *canvas, const QList<QgsMapLayer *> &layers );
241
242 QString uniqueGroupName( QgsLayerTreeGroup *parentGroup );
243
244 protected:
246};
247
248
249#endif // QGSLAYERTREEVIEWDEFAULTACTIONS_H
Layer tree group node serves as a container for layers and further groups.
Base class for QTreeView widgets which display a layer tree.
QAction * actionRemoveGroupOrLayer(QObject *parent=nullptr)
Returns a new action which removes either a group or layer, depending on the selected node.
void removeGroupPromoteLayers()
Removes the selected group node, promoting all child nodes up into the removed group's parent node.
void zoomToLayers(QgsMapCanvas *canvas)
Zooms a map canvas to all the selected layer(s) in the layer tree.
QAction * actionZoomToLayers(QgsMapCanvas *canvas, QObject *parent=nullptr)
Action to zoom to all the selected layer(s) in the layer tree.
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 ...
QAction * actionMoveToTop(QObject *parent=nullptr)
QAction * actionShowInOverview(QObject *parent=nullptr)
Returns a new action for toggling whether a layer is shown in the map overview.
QAction * actionRenameGroupOrLayer(QObject *parent=nullptr)
Returns a new action for renaming a group or layer, depending on the selected node.
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.
void moveToBottom()
Moves selected layer(s) and/or group(s) to the bottom of the layer panel or the bottom of the group i...
QAction * actionRemoveGroupPromoteLayers(QObject *parent=nullptr)
Returns a new action which removes a group.
Q_DECL_DEPRECATED QAction * actionZoomToLayer(QgsMapCanvas *canvas, QObject *parent=nullptr)
Action to zoom to the active layer from the layer tree.
QAction * actionAddGroup(QObject *parent=nullptr)
Returns a new action which adds a group.
QAction * actionGroupSelected(QObject *parent=nullptr)
QgsLayerTreeViewDefaultActions(QgsLayerTreeViewBase *view)
Constructor for QgsLayerTreeViewDefaultActions, creating actions for a view.
QAction * actionMoveToBottom(QObject *parent=nullptr)
QAction * actionShowFeatureCount(QObject *parent=nullptr)
Returns a new action for toggling whether the feature count is shown for a layer.
Q_DECL_DEPRECATED void zoomToLayer(QgsMapCanvas *canvas)
Zooms a map canvas to the extent of the active layer in the layer tree.
QAction * actionMutuallyExclusiveGroup(QObject *parent=nullptr)
Action to enable/disable mutually exclusive flag of a group (only one child node may be checked).
Q_DECL_DEPRECATED QAction * actionMakeTopLevel(QObject *parent=nullptr)
QString uniqueGroupName(QgsLayerTreeGroup *parentGroup)
QAction * actionUncheckAndAllChildren(QObject *parent=nullptr)
Action to uncheck a group and all its children.
void mutuallyExclusiveGroup()
Slot to enable/disable mutually exclusive group flag.
void moveOutOfGroup()
Moves selected layer(s) out of the group(s) and places this/these above the group(s).
QAction * actionZoomToSelection(QgsMapCanvas *canvas, QObject *parent=nullptr)
Action to zoom to selected features of a vector layer.
QAction * actionMoveOutOfGroup(QObject *parent=nullptr)
QAction * actionZoomToGroup(QgsMapCanvas *canvas, QObject *parent=nullptr)
Map canvas is a class for displaying all GIS data types on a canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:80
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_FACTORY
Definition qgis_sip.h:84