QGIS API Documentation  2.99.0-Master (69af2f5)
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;
68  QAction *actionMutuallyExclusiveGroup( QObject *parent = nullptr ) SIP_FACTORY;
69 
70  void zoomToLayer( QgsMapCanvas *canvas );
71  void zoomToGroup( QgsMapCanvas *canvas );
72 
73  public slots:
74  void showInOverview();
75  void addGroup();
76 
77  protected slots:
78  void removeGroupOrLayer();
79  void renameGroupOrLayer();
80  void showFeatureCount();
81  void zoomToLayer();
82  void zoomToGroup();
83  void makeTopLevel();
84  void groupSelected();
87  void mutuallyExclusiveGroup();
88 
89  private slots:
90  void checkAndAllChildren();
91  void uncheckAndAllChildren();
92  void checkAndAllParents();
93 
94  protected:
95  void zoomToLayers( QgsMapCanvas *canvas, const QList<QgsMapLayer *> &layers );
96 
97  QString uniqueGroupName( QgsLayerTreeGroup *parentGroup );
98 
99  protected:
100  QgsLayerTreeView *mView = nullptr;
101 };
102 
103 
104 #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:54
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:57