QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
src
core
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
32
#include "
qgsaction.h
"
33
#include "
qgsfeature.h
"
34
35
class
QDomNode;
36
class
QDomDocument;
37
class
QgsPythonUtils;
38
class
QgsVectorLayer
;
39
class
QgsExpressionContextScope
;
40
class
QgsExpressionContext
;
41
51
class
CORE_EXPORT
QgsActionManager
:
public
QObject
52
{
53
Q_OBJECT
54
55
public
:
57
QgsActionManager
(
QgsVectorLayer
*layer )
58
: mLayer( layer )
59
{}
60
68
QUuid addAction(
QgsAction::ActionType
type,
const
QString &name,
const
QString &command,
bool
capture =
false
);
69
77
QUuid addAction(
QgsAction::ActionType
type,
const
QString &name,
const
QString &command,
const
QString &icon,
bool
capture =
false
);
78
82
void
addAction(
const
QgsAction
&action );
83
89
void
removeAction( QUuid actionId );
90
101
void
doAction( QUuid actionId,
const
QgsFeature
&feature,
int
defaultValueIndex = 0,
const
QgsExpressionContextScope
&scope =
QgsExpressionContextScope
() )
SIP_PYNAME
( doActionFeature );
102
110
void
doAction( QUuid actionId, const
QgsFeature
&feature, const
QgsExpressionContext
&context );
111
113
void
clearActions();
114
121
QList<
QgsAction
> actions( const QString &actionScope = QString() ) const;
122
124
QgsVectorLayer
*layer()
const
{
return
mLayer; }
125
127
bool
writeXml( QDomNode &layer_node )
const
;
128
130
bool
readXml(
const
QDomNode &layer_node );
131
137
QgsAction
action( QUuid
id
);
138
145
void
setDefaultAction(
const
QString &actionScope, QUuid actionId );
146
153
QgsAction
defaultAction(
const
QString &actionScope );
154
155
private
:
156
QList<QgsAction> mActions;
157
QgsVectorLayer
*mLayer =
nullptr
;
158
static
void ( *smPythonExecute )(
const
QString & );
159
160
void
runAction(
const
QgsAction
&action );
161
162
QMap<QString, QUuid> mDefaultActions;
163
164
bool
mOnNotifyConnected =
false
;
165
166
QgsExpressionContext
createExpressionContext()
const
;
167
168
private
slots:
169
void
onNotifyRunActions(
const
QString &message );
170
};
171
172
#endif
QgsActionManager::QgsActionManager
QgsActionManager(QgsVectorLayer *layer)
Constructor.
Definition:
qgsactionmanager.h:57
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition:
qgsexpressioncontext.h:370
SIP_PYNAME
#define SIP_PYNAME(name)
Definition:
qgis_sip.h:81
qgsfeature.h
qgsaction.h
QgsAction::ActionType
ActionType
Definition:
qgsaction.h:39
QgsExpressionContextScope
Single scope for storing variables and functions for use within a QgsExpressionContext.
Definition:
qgsexpressioncontext.h:112
QgsAction
Utility class that encapsulates an action based on vector attributes.
Definition:
qgsaction.h:36
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition:
qgsvectorlayer.h:387
QgsFeature
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition:
qgsfeature.h:56
QgsActionManager
Storage and management of actions associated with a layer.
Definition:
qgsactionmanager.h:52
Generated on Sat Oct 24 2020 17:43:09 for QGIS API Documentation by
1.8.20