QGIS API Documentation 3.99.0-Master (26c88405ac0)
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:
42
49
53 QAction *actionAddGroup( QObject *parent = nullptr ) SIP_FACTORY;
54
62 QAction *actionRemoveGroupOrLayer( QObject *parent = nullptr ) SIP_FACTORY;
63
73 QAction *actionRemoveGroupPromoteLayers( QObject *parent = nullptr ) SIP_FACTORY;
74
78 QAction *actionShowInOverview( QObject *parent = nullptr ) SIP_FACTORY;
79
83 QAction *actionRenameGroupOrLayer( QObject *parent = nullptr ) SIP_FACTORY;
84
88 QAction *actionShowFeatureCount( QObject *parent = nullptr ) SIP_FACTORY;
89
91 QAction *actionCheckAndAllChildren( QObject *parent = nullptr );
92
94 QAction *actionUncheckAndAllChildren( QObject *parent = nullptr );
95
97 QAction *actionCheckAndAllParents( QObject *parent = nullptr );
98
103 Q_DECL_DEPRECATED QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY SIP_DEPRECATED;
104
109 QAction *actionZoomToLayers( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
110
115 QAction *actionZoomToSelection( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
116 QAction *actionZoomToGroup( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
117
121 Q_DECL_DEPRECATED QAction *actionMakeTopLevel( QObject *parent = nullptr ) SIP_FACTORY;
122
127 QAction *actionMoveOutOfGroup( QObject *parent = nullptr ) SIP_FACTORY;
128
133 QAction *actionMoveToTop( QObject *parent = nullptr ) SIP_FACTORY;
134
139 QAction *actionMoveToBottom( QObject *parent = nullptr ) SIP_FACTORY;
140 QAction *actionGroupSelected( QObject *parent = nullptr ) SIP_FACTORY;
141
145 QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;
146
151 Q_DECL_DEPRECATED void zoomToLayer( QgsMapCanvas *canvas ) SIP_DEPRECATED;
152
158 void zoomToLayers( QgsMapCanvas *canvas );
159
164 void zoomToSelection( QgsMapCanvas *canvas );
165 void zoomToGroup( QgsMapCanvas *canvas );
166
167 public slots:
168 void showInOverview();
169 void addGroup();
170
171 protected slots:
172 void removeGroupOrLayer();
173
181
182 void renameGroupOrLayer();
183 void showFeatureCount();
184
189 Q_DECL_DEPRECATED void zoomToLayer() SIP_DEPRECATED;
190
195 void zoomToLayers();
196
201 void zoomToSelection();
202 void zoomToGroup();
203
207 Q_DECL_DEPRECATED void makeTopLevel() SIP_DEPRECATED;
208
213 void moveOutOfGroup();
214
220 void moveToTop();
221
227 void moveToBottom();
228 void groupSelected();
229
234
235 private slots:
236 void checkAndAllChildren();
237 void uncheckAndAllChildren();
238 void checkAndAllParents();
239
240 protected:
241 void zoomToLayers( QgsMapCanvas *canvas, const QList<QgsMapLayer *> &layers );
242
243 QString uniqueGroupName( QgsLayerTreeGroup *parentGroup );
244
245 protected:
247};
248
249
250#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