QGIS API Documentation  2.99.0-Master (ae4d26a)
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  QAction *actionZoomToGroup( QgsMapCanvas *canvas, QObject *parent = nullptr ) SIP_FACTORY;
62  // TODO: zoom to selected
63 
64  QAction *actionMakeTopLevel( QObject *parent = nullptr ) SIP_FACTORY;
65  QAction *actionGroupSelected( QObject *parent = nullptr ) SIP_FACTORY;
66 
71  QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;
72 
73  void zoomToLayer( QgsMapCanvas *canvas );
74  void zoomToGroup( QgsMapCanvas *canvas );
75 
76  public slots:
77  void showInOverview();
78  void addGroup();
79 
80  protected slots:
81  void removeGroupOrLayer();
82  void renameGroupOrLayer();
83  void showFeatureCount();
84  void zoomToLayer();
85  void zoomToGroup();
86  void makeTopLevel();
87  void groupSelected();
88 
93  void mutuallyExclusiveGroup();
94 
95  private slots:
96  void checkAndAllChildren();
97  void uncheckAndAllChildren();
98  void checkAndAllParents();
99 
100  protected:
101  void zoomToLayers( QgsMapCanvas *canvas, const QList<QgsMapLayer *> &layers );
102 
103  QString uniqueGroupName( QgsLayerTreeGroup *parentGroup );
104 
105  protected:
106  QgsLayerTreeView *mView = nullptr;
107 };
108 
109 
110 #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:56
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:74
The QgsLayerTreeViewDefaultActions class serves as a factory of actions that can be used together wit...
#define SIP_FACTORY
Definition: qgis_sip.h:69