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