diff --git a/python/core/qgsattributeaction.sip b/python/core/qgsattributeaction.sip index 41b7eb4e251..7d50606559b 100644 --- a/python/core/qgsattributeaction.sip +++ b/python/core/qgsattributeaction.sip @@ -51,7 +51,10 @@ class QgsAttributeAction // dialog box. void addAction( QgsAction::ActionType type, QString name, QString action, bool capture = false ); - /*! Does the given values. defaultValueIndex is the index of the + //! Remove an action at given index + void removeAction( int index ); + + /*! Does the given values. defaultValueIndex is the index of the * field to be used if the action has a $currfield placeholder. * @note added in 1.9 * @note not available in python bindings diff --git a/src/core/qgsattributeaction.cpp b/src/core/qgsattributeaction.cpp index 67b51a8bc48..fd8b006a442 100644 --- a/src/core/qgsattributeaction.cpp +++ b/src/core/qgsattributeaction.cpp @@ -45,6 +45,14 @@ void QgsAttributeAction::addAction( QgsAction::ActionType type, QString name, QS mActions << QgsAction( type, name, action, capture ); } +void QgsAttributeAction::removeAction( int index ) +{ + if ( index >= 0 && index < mActions.size() ) + { + mActions.removeAt( index ); + } +} + void QgsAttributeAction::doAction( int index, QgsFeature &feat, int defaultValueIndex ) { QMap substitutionMap; diff --git a/src/core/qgsattributeaction.h b/src/core/qgsattributeaction.h index 77b165f1242..6ea33c300de 100644 --- a/src/core/qgsattributeaction.h +++ b/src/core/qgsattributeaction.h @@ -109,6 +109,9 @@ class CORE_EXPORT QgsAttributeAction // dialog box. void addAction( QgsAction::ActionType type, QString name, QString action, bool capture = false ); + //! Remove an action at given index + void removeAction( int index ); + /*! Does the given values. defaultValueIndex is the index of the * field to be used if the action has a $currfield placeholder. * @note added in 1.9