|
Quantum GIS API Documentation
master-693a1fe
|
Storage and management of actions associated with Qgis layer attributes. More...
#include <qgsattributeaction.h>
Collaboration diagram for QgsAttributeAction: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. | |
| QgsAction & | at (int idx) |
| void | clearActions () |
| Removes all actions. | |
| int | defaultAction () const |
| Whether the action is the default action. | |
| void | doAction (int index, QgsFeature &feat, int defaultValueIndex=0) |
| void | doAction (int index, QgsFeature &feat, const QMap< QString, QVariant > *substitutionMap=0) |
| 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. | |
| 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 &)) |
Private Member Functions | |
| void | runAction (const QgsAction &action, void(*executePython)(const QString &)=0) |
Private Attributes | |
| QList< QgsAction > | mActions |
| int | mDefaultAction |
| QgsVectorLayer * | mLayer |
Static Private Attributes | |
| static void(* | smPythonExecute )(const QString &) |
Storage and management of actions associated with Qgis layer attributes.
Definition at line 96 of file qgsattributeaction.h.
| QgsAttributeAction::QgsAttributeAction | ( | QgsVectorLayer * | layer | ) | [inline] |
Constructor.
Definition at line 100 of file qgsattributeaction.h.
| virtual QgsAttributeAction::~QgsAttributeAction | ( | ) | [inline, virtual] |
Destructor.
Definition at line 103 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.
Definition at line 43 of file qgsattributeaction.cpp.
References mActions.
Referenced by readXML().
| QgsAction& QgsAttributeAction::at | ( | int | idx | ) | [inline] |
Definition at line 168 of file qgsattributeaction.h.
Referenced by doAction(), and QgsDualView::viewWillShowContextMenu().
| void QgsAttributeAction::clearActions | ( | ) | [inline] |
Removes all actions.
Definition at line 136 of file qgsattributeaction.h.
| int QgsAttributeAction::defaultAction | ( | ) | const [inline] |
Whether the action is the default action.
Definition at line 175 of file qgsattributeaction.h.
References size.
| void QgsAttributeAction::doAction | ( | int | index, |
| 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 56 of file qgsattributeaction.cpp.
References QgsFeature::attribute().
Referenced by QgsAttributeTableModel::executeAction().
| void QgsAttributeAction::doAction | ( | int | index, |
| QgsFeature & | feat, | ||
| const QMap< QString, QVariant > * | substitutionMap = 0 |
||
| ) |
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 69 of file qgsattributeaction.cpp.
References QgsAction::action(), at(), QgsAction::capture(), mLayer, QgsAction::name(), QgsExpression::replaceExpressionText(), QgsAction::runable(), runAction(), size(), and QgsAction::type().
| 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 124 of file qgsattributeaction.cpp.
References QgsVectorLayer::attributeDisplayName(), QgsFields::count(), mLayer, and QgsVectorLayer::pendingFields().
| 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 174 of file qgsattributeaction.cpp.
References QgsExpression::evalErrorString(), QgsExpression::evaluate(), QgsExpression::hasEvalError(), QgsExpression::hasParserError(), mLayer, QgsExpression::parserErrorString(), QgsVectorLayer::pendingFields(), and QgsDebugMsg.
| QgsVectorLayer* QgsAttributeAction::layer | ( | ) | [inline] |
Return the layer.
Definition at line 139 of file qgsattributeaction.h.
| QgsAction& QgsAttributeAction::operator[] | ( | int | idx | ) | [inline] |
Definition at line 169 of file qgsattributeaction.h.
| bool QgsAttributeAction::readXML | ( | const QDomNode & | layer_node | ) |
Reads the actions in in XML format.
Definition at line 249 of file qgsattributeaction.cpp.
References addAction(), and mActions.
Referenced by QgsVectorLayer::readSymbology().
| void QgsAttributeAction::removeAction | ( | int | index | ) |
Remove an action at given index.
Definition at line 48 of file qgsattributeaction.cpp.
References mActions.
| void QgsAttributeAction::runAction | ( | const QgsAction & | action, |
| void(*)(const QString &) | executePython = 0 |
||
| ) | [private] |
Definition at line 88 of file qgsattributeaction.cpp.
References QgsAction::action(), QgsAction::capture(), QgsRunProcess::create(), QgsAction::GenericPython, QgsAction::OpenUrl, QgsPythonRunner::run(), smPythonExecute, and QgsAction::type().
Referenced by doAction().
| void QgsAttributeAction::setDefaultAction | ( | int | actionNumber | ) | [inline] |
Definition at line 176 of file qgsattributeaction.h.
| void QgsAttributeAction::setPythonExecute | ( | void(*)(const QString &) | runPython | ) | [static] |
Definition at line 272 of file qgsattributeaction.cpp.
References smPythonExecute.
| int QgsAttributeAction::size | ( | ) | const [inline] |
Definition at line 167 of file qgsattributeaction.h.
Referenced by doAction(), and QgsDualView::viewWillShowContextMenu().
| bool QgsAttributeAction::writeXML | ( | QDomNode & | layer_node, |
| QDomDocument & | doc | ||
| ) | const |
Writes the actions out in XML format.
Definition at line 231 of file qgsattributeaction.cpp.
References mActions.
Referenced by QgsVectorLayer::writeSymbology().
QList<QgsAction> QgsAttributeAction::mActions [private] |
Definition at line 179 of file qgsattributeaction.h.
Referenced by addAction(), readXML(), removeAction(), and writeXML().
int QgsAttributeAction::mDefaultAction [private] |
Definition at line 186 of file qgsattributeaction.h.
QgsVectorLayer* QgsAttributeAction::mLayer [private] |
Definition at line 180 of file qgsattributeaction.h.
Referenced by doAction(), and expandAction().
void(* QgsAttributeAction::smPythonExecute)(const QString &)=0 [static, private] |
Definition at line 181 of file qgsattributeaction.h.
Referenced by runAction(), and setPythonExecute().