QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsmaplayeractionregistry.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmaplayeractionregistry.h
3 ---------------------------
4 begin : January 2014
5 copyright : (C) 2014 by Nyall Dawson
6 email : nyall dot dawson 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 QGSMAPLAYERACTIONREGISTRY_H
17#define QGSMAPLAYERACTIONREGISTRY_H
18
19#include "qgis_sip.h"
20#include "qgis.h"
21#include "qgis_gui.h"
23
24#include <QObject>
25#include <QList>
26#include <QMap>
27
28class QgsFeature;
29class QgsMapLayer;
31
32
40class GUI_EXPORT QgsMapLayerActionRegistry : public QObject
41{
42 Q_OBJECT
43
44 public:
45
52 QgsMapLayerActionRegistry( QObject *parent = nullptr );
53
55 void addMapLayerAction( QgsMapLayerAction *action );
56
62 QList<QgsMapLayerAction *> mapLayerActions( QgsMapLayer *layer, Qgis::MapLayerActionTargets targets = Qgis::MapLayerActionTarget::AllActions, const QgsMapLayerActionContext &context = QgsMapLayerActionContext() );
63
65 bool removeMapLayerAction( QgsMapLayerAction *action );
66
68 void setDefaultActionForLayer( QgsMapLayer *layer, QgsMapLayerAction *action );
70 QgsMapLayerAction *defaultActionForLayer( QgsMapLayer *layer );
71
72 protected:
73
74 QList< QgsMapLayerAction * > mMapLayerActionList;
75
76 signals:
78 void changed();
79
80 private:
81
82 QMap< QgsMapLayer *, QgsMapLayerAction * > mDefaultLayerActionMap;
83
84};
85
86#endif // QGSMAPLAYERACTIONREGISTRY_H
QFlags< MapLayerActionTarget > MapLayerActionTargets
Map layer action targets.
Definition: qgis.h:3842
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:56
Encapsulates the context in which a QgsMapLayerAction action is executed.
This class tracks map layer actions.
void changed()
Triggered when an action is added or removed from the registry.
QList< QgsMapLayerAction * > mMapLayerActionList
An action which can run on map layers The class can be used in two manners:
Base class for all map layer types.
Definition: qgsmaplayer.h:75