24 #ifndef QGSATTRIBUTEACTION_H
25 #define QGSATTRIBUTEACTION_H
54 mType( type ), mName( name ), mAction( action ), mCaptureOutput( capture ) {}
57 QString
name()
const {
return mName; }
60 QString
action()
const {
return mAction; }
66 bool capture()
const {
return mCaptureOutput; }
71 return mType == Generic ||
72 mType == GenericPython ||
76 #elif defined(Q_OS_MAC)
113 void removeAction(
int index );
120 void doAction(
int index,
122 int defaultValueIndex = 0 );
131 void doAction(
int index,
133 const QMap<QString, QVariant> *substitutionMap = 0 );
147 QString expandAction( QString action,
const QgsAttributeMap &attributes, uint defaultValueIndex );
159 QString expandAction( QString action,
161 const QMap<QString, QVariant> *substitutionMap = 0 );
165 bool writeXML( QDomNode& layer_node, QDomDocument& doc )
const;
168 bool readXML(
const QDomNode& layer_node );
170 int size()
const {
return mActions.size(); }
175 static void setPythonExecute(
void ( * )(
const QString & ) );
178 int defaultAction()
const {
return mDefaultAction < 0 || mDefaultAction >=
size() ? -1 : mDefaultAction; }
184 static void ( *smPythonExecute )(
const QString & );
187 void ( *executePython )(
const QString & ) = 0 );
QMap< int, QVariant > QgsAttributeMap
QgsAction & operator[](int idx)
Storage and management of actions associated with Qgis layer attributes.
QgsAction(ActionType type, QString name, QString action, bool capture)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool capture() const
Whether to capture output for display when this action is run.
QString name() const
The name of the action.
Utility class that encapsulates an action based on vector attributes.
QList< QgsAction > mActions
QString action() const
The action.
ActionType type() const
The action type.
virtual ~QgsAttributeAction()
Destructor.
const QList< QgsAction > & listActions()
List all actions.
QgsVectorLayer * layer()
Return the layer.
bool runable() const
Whether the action is runable on the current platform.
QgsAttributeAction(QgsVectorLayer *layer)
Constructor.
Represents a vector layer which manages a vector based data sets.
void setDefaultAction(int actionNumber)
void clearActions()
Removes all actions.
int defaultAction() const
Whether the action is the default action.