QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | List of all members
QgsAttributeAction Class Reference

Storage and management of actions associated with Qgis layer attributes. More...

#include <qgsattributeaction.h>

Public Member Functions

 QgsAttributeAction (QgsVectorLayer *layer)
 Constructor. More...
 
virtual ~QgsAttributeAction ()
 Destructor. More...
 
void addAction (QgsAction::ActionType type, QString name, QString action, bool capture=false)
 Add an action with the given name and action details. More...
 
void addAction (QgsAction::ActionType type, QString name, QString action, const QString &icon, bool capture=false)
 Add an action with the given name and action details. More...
 
QgsActionat (int idx)
 
void clearActions ()
 Removes all actions. More...
 
int defaultAction () const
 Whether the action is the default action. More...
 
void doAction (int index, const QgsFeature &feat, int defaultValueIndex=0)
 Does the given values. More...
 
void doAction (int index, const QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap)
 Does the action using the expression builder to expand it and getting values from the passed feature attribute map. More...
 
QString expandAction (QString action, const QgsAttributeMap &attributes, uint defaultValueIndex)
 Expands the given action, replacing all 's with the value as given. More...
 
QString expandAction (QString action, QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap=0)
 Expands the given action using the expression builder This function currently replaces each expression between [% and %] placeholders in the action with the result of its evaluation on the feature passed as argument. More...
 
QgsVectorLayerlayer ()
 Return the layer. More...
 
const QList< QgsAction > & listActions ()
 List all actions. More...
 
QgsActionoperator[] (int idx)
 
bool readXML (const QDomNode &layer_node)
 Reads the actions in in XML format. More...
 
void removeAction (int index)
 Remove an action at given index. More...
 
void setDefaultAction (int actionNumber)
 
int size () const
 
bool writeXML (QDomNode &layer_node, QDomDocument &doc) const
 Writes the actions out in XML format. More...
 

Static Public Member Functions

static void setPythonExecute (void(*)(const QString &))
 

Detailed Description

Storage and management of actions associated with Qgis layer attributes.

Definition at line 107 of file qgsattributeaction.h.

Constructor & Destructor Documentation

QgsAttributeAction::QgsAttributeAction ( QgsVectorLayer layer)
inline

Constructor.

Definition at line 111 of file qgsattributeaction.h.

virtual QgsAttributeAction::~QgsAttributeAction ( )
inlinevirtual

Destructor.

Definition at line 114 of file qgsattributeaction.h.

Member Function Documentation

void QgsAttributeAction::addAction ( QgsAction::ActionType  type,
QString  name,
QString  action,
bool  capture = false 
)

Add an action with the given name and action details.

Will happily have duplicate names and actions. If capture is true, when running the action using doAction(), any stdout from the process will be captured and displayed in a dialog box.

Definition at line 43 of file qgsattributeaction.cpp.

void QgsAttributeAction::addAction ( QgsAction::ActionType  type,
QString  name,
QString  action,
const QString icon,
bool  capture = false 
)

Add an action with the given name and action details.

Will happily have duplicate names and actions. If capture is true, when running the action using doAction(), any stdout from the process will be captured and displayed in a dialog box.

Definition at line 48 of file qgsattributeaction.cpp.

QgsAction& QgsAttributeAction::at ( int  idx)
inline

Definition at line 187 of file qgsattributeaction.h.

void QgsAttributeAction::clearActions ( )
inline

Removes all actions.

Definition at line 154 of file qgsattributeaction.h.

int QgsAttributeAction::defaultAction ( ) const
inline

Whether the action is the default action.

Definition at line 194 of file qgsattributeaction.h.

void QgsAttributeAction::doAction ( int  index,
const QgsFeature feat,
int  defaultValueIndex = 0 
)

Does the given values.

defaultValueIndex is the index of the field to be used if the action has a $currfield placeholder.

Note
available in python bindings as doActionFeature

Definition at line 61 of file qgsattributeaction.cpp.

void QgsAttributeAction::doAction ( int  index,
const QgsFeature feat,
const QMap< QString, QVariant > *  substitutionMap 
)

Does the action using the expression builder to expand it and getting values from the passed feature attribute map.

substitutionMap is used to pass custom substitutions, to replace each key in the map with the associated value

Note
available in python bindings as doActionFeatureWithSubstitution

Definition at line 74 of file qgsattributeaction.cpp.

QString QgsAttributeAction::expandAction ( QString  action,
const QgsAttributeMap attributes,
uint  defaultValueIndex 
)

Expands the given action, replacing all 's with the value as given.

Definition at line 141 of file qgsattributeaction.cpp.

QString QgsAttributeAction::expandAction ( QString  action,
QgsFeature feat,
const QMap< QString, QVariant > *  substitutionMap = 0 
)

Expands the given action using the expression builder This function currently replaces each expression between [% and %] placeholders in the action with the result of its evaluation on the feature passed as argument.

Additional substitutions can be passed through the substitutionMap parameter

Definition at line 191 of file qgsattributeaction.cpp.

QgsVectorLayer* QgsAttributeAction::layer ( )
inline

Return the layer.

Definition at line 160 of file qgsattributeaction.h.

const QList<QgsAction>& QgsAttributeAction::listActions ( )
inline

List all actions.

Definition at line 157 of file qgsattributeaction.h.

QgsAction& QgsAttributeAction::operator[] ( int  idx)
inline

Definition at line 188 of file qgsattributeaction.h.

bool QgsAttributeAction::readXML ( const QDomNode layer_node)

Reads the actions in in XML format.

Definition at line 270 of file qgsattributeaction.cpp.

void QgsAttributeAction::removeAction ( int  index)

Remove an action at given index.

Definition at line 53 of file qgsattributeaction.cpp.

void QgsAttributeAction::setDefaultAction ( int  actionNumber)
inline

Definition at line 195 of file qgsattributeaction.h.

void QgsAttributeAction::setPythonExecute ( void(*)(const QString &)  runPython)
static
Deprecated:
Initialize QgsPythonRunner instead

Definition at line 294 of file qgsattributeaction.cpp.

int QgsAttributeAction::size ( ) const
inline

Definition at line 186 of file qgsattributeaction.h.

bool QgsAttributeAction::writeXML ( QDomNode layer_node,
QDomDocument doc 
) const

Writes the actions out in XML format.

Definition at line 251 of file qgsattributeaction.cpp.


The documentation for this class was generated from the following files: