QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
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 <QObject>
20 #include "qgis.h"
21 #include "qgis_gui.h"
22 
23 class QAction;
24 
25 class QgsLayerTreeGroup;
26 class QgsLayerTreeView;
27 class QgsMapCanvas;
28 class QgsMapLayer;
29 
30 
39 class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
40 {
41  Q_OBJECT
42  public:
44 
45  QAction *actionAddGroup( QObject *parent = nullptr ) SIP_FACTORY;
46  QAction *actionRemoveGroupOrLayer( QObject *parent = nullptr ) SIP_FACTORY;
47  QAction *actionShowInOverview( QObject *parent = nullptr ) SIP_FACTORY;
48  QAction *actionRenameGroupOrLayer( QObject *parent = nullptr ) SIP_FACTORY;
49  QAction *actionShowFeatureCount( QObject *parent = nullptr ) SIP_FACTORY;
50 
52  QAction *actionCheckAndAllChildren( QObject *parent = nullptr );
53 
55  QAction *actionUncheckAndAllChildren( QObject *parent = nullptr );
56 
58  QAction *actionCheckAndAllParents( QObject *parent = nullptr );
59 
60  QAction *actionZoomToLayer( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
61 
66  QAction *actionZoomToSelection( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
67  QAction *actionZoomToGroup( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
68 
72  Q_DECL_DEPRECATED QAction *actionMakeTopLevel( QObject *parent = nullptr ) SIP_FACTORY;
73 
78  QAction *actionMoveOutOfGroup( QObject *parent = nullptr ) SIP_FACTORY;
79 
84  QAction *actionMoveToTop( QObject *parent = nullptr ) SIP_FACTORY;
85 
90  QAction *actionMoveToBottom( QObject *parent = nullptr ) SIP_FACTORY;
91  QAction *actionGroupSelected( QObject *parent = nullptr ) SIP_FACTORY;
92 
97  QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;
98 
99  void zoomToLayer( QgsMapCanvas *canvas );
100 
105  void zoomToSelection( QgsMapCanvas *canvas );
106  void zoomToGroup( QgsMapCanvas *canvas );
107 
108  public slots:
109  void showInOverview();
110  void addGroup();
111 
112  protected slots:
113  void removeGroupOrLayer();
114  void renameGroupOrLayer();
115  void showFeatureCount();
116  void zoomToLayer();
117 
122  void zoomToSelection();
123  void zoomToGroup();
124 
128  Q_DECL_DEPRECATED void makeTopLevel();
129 
134  void moveOutOfGroup();
135 
141  void moveToTop();
142 
148  void moveToBottom();
149  void groupSelected();
150 
155  void mutuallyExclusiveGroup();
156 
157  private slots:
158  void checkAndAllChildren();
159  void uncheckAndAllChildren();
160  void checkAndAllParents();
161 
162  protected:
163  void zoomToLayers( QgsMapCanvas *canvas, const QList<QgsMapLayer *> &layers );
164 
165  QString uniqueGroupName( QgsLayerTreeGroup *parentGroup );
166 
167  protected:
168  QgsLayerTreeView *mView = nullptr;
169 };
170 
171 
172 #endif // QGSLAYERTREEVIEWDEFAULTACTIONS_H
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:85
qgis.h
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsLayerTreeGroup
Layer tree group node serves as a container for layers and further groups.
Definition: qgslayertreegroup.h:35
QgsLayerTreeViewDefaultActions
The QgsLayerTreeViewDefaultActions class serves as a factory of actions that can be used together wit...
Definition: qgslayertreeviewdefaultactions.h:40
QgsMapLayer
Base class for all map layer types.
Definition: qgsmaplayer.h:83
QgsLayerTreeView
The QgsLayerTreeView class extends QTreeView and provides some additional functionality when working ...
Definition: qgslayertreeview.h:52