Skip to content

Commit

Permalink
Merge pull request #520 from 3nids/removeaction
Browse files Browse the repository at this point in the history
add removeAction method to layer actions
  • Loading branch information
mhugent committed Apr 12, 2013
2 parents 1a4ce3e + bc67bde commit 95f49be
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/core/qgsattributeaction.sip
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/core/qgsattributeaction.cpp
Expand Up @@ -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<QString, QVariant> substitutionMap;
Expand Down
3 changes: 3 additions & 0 deletions src/core/qgsattributeaction.h
Expand Up @@ -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
Expand Down

0 comments on commit 95f49be

Please sign in to comment.