QGIS API Documentation
2.8.2-Wien
|
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. | |
QgsAction & | at (int idx) |
void | clearActions () |
Removes all actions. | |
int | defaultAction () const |
Whether the action is the default action. | |
void | doAction (int index, const QgsFeature &feat, int defaultValueIndex=0) |
void | doAction (int index, const QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap) |
QString | expandAction (QString action, const QgsAttributeMap &attributes, uint defaultValueIndex) |
QString | expandAction (QString action, QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap=0) |
QgsVectorLayer * | layer () |
Return the layer. | |
const QList< QgsAction > & | listActions () |
List all actions. | |
QgsAction & | operator[] (int idx) |
bool | readXML (const QDomNode &layer_node) |
Reads the actions in in XML format. | |
void | removeAction (int index) |
Remove an action at given index. | |
void | setDefaultAction (int actionNumber) |
int | size () const |
bool | writeXML (QDomNode &layer_node, QDomDocument &doc) const |
Writes the actions out in XML format. |
Static Public Member Functions | |
static void | setPythonExecute (void(*)(const QString &)) |
Storage and management of actions associated with Qgis layer attributes.
Definition at line 106 of file qgsattributeaction.h.
|
inline |
Constructor.
Definition at line 110 of file qgsattributeaction.h.
|
inlinevirtual |
Destructor.
Definition at line 113 of file qgsattributeaction.h.
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.
|
inline |
Definition at line 186 of file qgsattributeaction.h.
|
inline |
Removes all actions.
Definition at line 153 of file qgsattributeaction.h.
|
inline |
Whether the action is the default action.
Definition at line 193 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.
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
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 128 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 178 of file qgsattributeaction.cpp.
|
inline |
Return the layer.
Definition at line 159 of file qgsattributeaction.h.
|
inline |
List all actions.
Definition at line 156 of file qgsattributeaction.h.
|
inline |
Definition at line 187 of file qgsattributeaction.h.
bool QgsAttributeAction::readXML | ( | const QDomNode & | layer_node | ) |
Reads the actions in in XML format.
Definition at line 254 of file qgsattributeaction.cpp.
void QgsAttributeAction::removeAction | ( | int | index | ) |
Remove an action at given index.
Definition at line 53 of file qgsattributeaction.cpp.
|
inline |
Definition at line 194 of file qgsattributeaction.h.
|
static |
Definition at line 278 of file qgsattributeaction.cpp.
|
inline |
Definition at line 185 of file qgsattributeaction.h.
bool QgsAttributeAction::writeXML | ( | QDomNode & | layer_node, |
QDomDocument & | doc | ||
) | const |
Writes the actions out in XML format.
Definition at line 235 of file qgsattributeaction.cpp.