QGIS API Documentation
3.30.0-'s-Hertogenbosch (f186b8efe0)
src
core
actions
qgsactionmanager.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsactionmanager.h
3
4
These classes store and control the management and execution of actions
5
associated with a particular QGIS layer. Actions are defined to be
6
external programs that are run with user-specified inputs that can
7
depend on the contents of layer attributes.
8
9
-------------------
10
begin : Oct 24 2004
11
copyright : (C) 2004 by Gavin Macaulay
12
email : gavin at macaulay dot co dot nz
13
***************************************************************************/
14
15
/***************************************************************************
16
* *
17
* This program is free software; you can redistribute it and/or modify *
18
* it under the terms of the GNU General Public License as published by *
19
* the Free Software Foundation; either version 2 of the License, or *
20
* (at your option) any later version. *
21
* *
22
***************************************************************************/
23
24
#ifndef QGSACTIONMANAGER_H
25
#define QGSACTIONMANAGER_H
26
27
#include "qgis_core.h"
28
#include <QString>
29
#include <QIcon>
30
#include <QObject>
31
#include <QUuid>
32
33
#include "
qgsexpressioncontext.h
"
34
#include "
qgsaction.h
"
35
36
class
QDomNode;
37
class
QDomDocument;
38
class
QgsPythonUtils;
39
class
QgsVectorLayer
;
40
class
QgsFeature
;
41
51
class
CORE_EXPORT
QgsActionManager
:
public
QObject
52
{
53
Q_OBJECT
54
55
public
:
57
QgsActionManager
(
QgsVectorLayer
*layer );
58
66
QUuid addAction(
Qgis::AttributeActionType
type,
const
QString &name,
const
QString &command,
bool
capture =
false
);
67
75
QUuid addAction(
Qgis::AttributeActionType
type,
const
QString &name,
const
QString &command,
const
QString &icon,
bool
capture =
false
);
76
80
void
addAction(
const
QgsAction
&action );
81
87
void
removeAction( QUuid actionId );
88
99
void
doAction( QUuid actionId,
const
QgsFeature
&feature,
int
defaultValueIndex = 0,
const
QgsExpressionContextScope
&scope =
QgsExpressionContextScope
() )
SIP_PYNAME
( doActionFeature );
100
108
void
doAction( QUuid actionId,
const
QgsFeature
&feature,
const
QgsExpressionContext
&context );
109
111
void
clearActions();
112
119
QList<QgsAction> actions(
const
QString &actionScope = QString() )
const
;
120
122
QgsVectorLayer
*
layer
()
const
{
return
mLayer; }
123
125
bool
writeXml( QDomNode &layer_node )
const
;
126
128
bool
readXml(
const
QDomNode &layer_node );
129
135
QgsAction
action( QUuid
id
)
const
;
136
142
QgsAction
action(
const
QString &
id
)
const
;
143
150
void
setDefaultAction(
const
QString &actionScope, QUuid actionId );
151
158
QgsAction
defaultAction(
const
QString &actionScope );
159
160
private
:
161
QList<QgsAction> mActions;
162
QgsVectorLayer
*mLayer =
nullptr
;
163
static
void ( *smPythonExecute )(
const
QString & );
164
165
void
runAction(
const
QgsAction
&action );
166
167
QMap<QString, QUuid> mDefaultActions;
168
169
bool
mOnNotifyConnected =
false
;
170
171
QgsExpressionContext
createExpressionContext()
const
;
172
173
private
slots:
174
void
onNotifyRunActions(
const
QString &message );
175
};
176
177
#endif
Qgis::AttributeActionType
AttributeActionType
Map layer action flags.
Definition:
qgis.h:2813
QgsActionManager
Storage and management of actions associated with a layer.
Definition:
qgsactionmanager.h:52
QgsActionManager::layer
QgsVectorLayer * layer() const
Returns the layer.
Definition:
qgsactionmanager.h:122
QgsAction
Utility class that encapsulates an action based on vector attributes.
Definition:
qgsaction.h:37
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition:
qgsexpressioncontext.h:118
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:481
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition:
qgsfeature.h:56
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:399
SIP_PYNAME
#define SIP_PYNAME(name)
Definition:
qgis_sip.h:81
qgsaction.h
qgsexpressioncontext.h
Generated on Sun Mar 5 2023 20:41:05 for QGIS API Documentation by
1.9.4