Storage and management of actions associated with Qgis layer attributes.
More...
#include <qgsattributeaction.h>
Public Member Functions |
| QgsAttributeAction (QgsVectorLayer *layer) |
| Constructor.
|
virtual | ~QgsAttributeAction () |
| Destructor.
|
void | addAction (QgsAction::ActionType type, QString name, QString action, bool capture=false) |
| Add an action with the given name and action details.
|
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.
|
void | removeAction (int index) |
| Remove an action at given index.
|
void | doAction (int index, const QgsFeature &feat, int defaultValueIndex=0) |
void | doAction (int index, const QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap) |
void | clearActions () |
| Removes all actions.
|
const QList< QgsAction > & | listActions () |
| List all actions.
|
QgsVectorLayer * | layer () |
| Return the layer.
|
QString | expandAction (QString action, const QgsAttributeMap &attributes, uint defaultValueIndex) |
QString | expandAction (QString action, QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap=0) |
bool | writeXML (QDomNode &layer_node, QDomDocument &doc) const |
| Writes the actions out in XML format.
|
bool | readXML (const QDomNode &layer_node) |
| Reads the actions in in XML format.
|
int | size () const |
QgsAction & | at (int idx) |
QgsAction & | operator[] (int idx) |
int | defaultAction () const |
| Whether the action is the default action.
|
void | setDefaultAction (int actionNumber) |
Static Public Member Functions |
static void | setPythonExecute (void(*)(const QString &)) |
Detailed Description
Storage and management of actions associated with Qgis layer attributes.
Constructor & Destructor Documentation
virtual QgsAttributeAction::~QgsAttributeAction |
( |
| ) |
|
|
inlinevirtual |
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.
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.
void QgsAttributeAction::clearActions |
( |
| ) |
|
|
inline |
int QgsAttributeAction::defaultAction |
( |
| ) |
const |
|
inline |
Whether the action is the default action.
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
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
QString QgsAttributeAction::expandAction |
( |
QString |
action, |
|
|
const QgsAttributeMap & |
attributes, |
|
|
uint |
defaultValueIndex |
|
) |
| |
Expands the given action, replacing all 's with the value as given.
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
const QList<QgsAction>& QgsAttributeAction::listActions |
( |
| ) |
|
|
inline |
QgsAction& QgsAttributeAction::operator[] |
( |
int |
idx | ) |
|
|
inline |
bool QgsAttributeAction::readXML |
( |
const QDomNode & |
layer_node | ) |
|
Reads the actions in in XML format.
void QgsAttributeAction::removeAction |
( |
int |
index | ) |
|
Remove an action at given index.
void QgsAttributeAction::setDefaultAction |
( |
int |
actionNumber | ) |
|
|
inline |
void QgsAttributeAction::setPythonExecute |
( |
void(*)(const QString &) |
runPython | ) |
|
|
static |
int QgsAttributeAction::size |
( |
| ) |
const |
|
inline |
bool QgsAttributeAction::writeXML |
( |
QDomNode & |
layer_node, |
|
|
QDomDocument & |
doc |
|
) |
| const |
Writes the actions out in XML format.
The documentation for this class was generated from the following files: