QGIS API Documentation  3.6.0-Noosa (5873452)
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  QAction *actionGroupSelected( QObject *parent = nullptr ) SIP_FACTORY;
86 
91  QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;
92 
93  void zoomToLayer( QgsMapCanvas *canvas );
94 
99  void zoomToSelection( QgsMapCanvas *canvas );
100  void zoomToGroup( QgsMapCanvas *canvas );
101 
102  public slots:
103  void showInOverview();
104  void addGroup();
105 
106  protected slots:
107  void removeGroupOrLayer();
108  void renameGroupOrLayer();
109  void showFeatureCount();
110  void zoomToLayer();
111 
116  void zoomToSelection();
117  void zoomToGroup();
118 
122  Q_DECL_DEPRECATED void makeTopLevel();
123 
128  void moveOutOfGroup();
129 
135  void moveToTop();
136  void groupSelected();
137 
142  void mutuallyExclusiveGroup();
143 
144  private slots:
145  void checkAndAllChildren();
146  void uncheckAndAllChildren();
147  void checkAndAllParents();
148 
149  protected:
150  void zoomToLayers( QgsMapCanvas *canvas, const QList<QgsMapLayer *> &layers );
151 
152  QString uniqueGroupName( QgsLayerTreeGroup *parentGroup );
153 
154  protected:
155  QgsLayerTreeView *mView = nullptr;
156 };
157 
158 
159 #endif // QGSLAYERTREEVIEWDEFAULTACTIONS_H
Layer tree group node serves as a container for layers and further groups.
Base class for all map layer types.
Definition: qgsmaplayer.h:64
The QgsLayerTreeView class extends QTreeView and provides some additional functionality when working ...
Map canvas is a class for displaying all GIS data types on a canvas.
Definition: qgsmapcanvas.h:73
The QgsLayerTreeViewDefaultActions class serves as a factory of actions that can be used together wit...
#define SIP_FACTORY
Definition: qgis_sip.h:69