QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
21 class QAction;
22 
23 class QgsLayerTreeGroup;
24 class QgsLayerTreeView;
25 class QgsMapCanvas;
26 class QgsMapLayer;
27 
28 
37 class GUI_EXPORT QgsLayerTreeViewDefaultActions : public QObject
38 {
39  Q_OBJECT
40  public:
42 
43  QAction* actionAddGroup( QObject* parent = nullptr );
44  QAction* actionRemoveGroupOrLayer( QObject* parent = nullptr );
45  QAction* actionShowInOverview( QObject* parent = nullptr );
46  QAction* actionRenameGroupOrLayer( QObject* parent = nullptr );
47  QAction* actionShowFeatureCount( QObject* parent = nullptr );
48 
49  QAction* actionZoomToLayer( QgsMapCanvas* canvas, QObject* parent = nullptr );
50  QAction* actionZoomToGroup( QgsMapCanvas* canvas, QObject* parent = nullptr );
51  // TODO: zoom to selected
52 
53  QAction* actionMakeTopLevel( QObject* parent = nullptr );
54  QAction* actionGroupSelected( QObject* parent = nullptr );
57  QAction* actionMutuallyExclusiveGroup( QObject* parent = nullptr );
58 
59  void zoomToLayer( QgsMapCanvas* canvas );
60  void zoomToGroup( QgsMapCanvas* canvas );
61 
62  public slots:
63  void showInOverview();
64 
65  protected slots:
66  void addGroup();
67  void removeGroupOrLayer();
68  void renameGroupOrLayer();
69  void showFeatureCount();
70  void zoomToLayer();
71  void zoomToGroup();
72  void makeTopLevel();
73  void groupSelected();
76  void mutuallyExclusiveGroup();
77 
78  protected:
79  void zoomToLayers( QgsMapCanvas* canvas, const QList<QgsMapLayer*>& layers );
80 
81  QString uniqueGroupName( QgsLayerTreeGroup* parentGroup );
82 
83  protected:
85 };
86 
87 
88 #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:49
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:109
The QgsLayerTreeViewDefaultActions class serves as a factory of actions that can be used together wit...