Skip to content

Commit 95f49be

Browse files
committedApr 12, 2013
Merge pull request #520 from 3nids/removeaction
add removeAction method to layer actions
2 parents 1a4ce3e + bc67bde commit 95f49be

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed
 

‎python/core/qgsattributeaction.sip

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ class QgsAttributeAction
5151
// dialog box.
5252
void addAction( QgsAction::ActionType type, QString name, QString action, bool capture = false );
5353

54-
/*! Does the given values. defaultValueIndex is the index of the
54+
//! Remove an action at given index
55+
void removeAction( int index );
56+
57+
/*! Does the given values. defaultValueIndex is the index of the
5558
* field to be used if the action has a $currfield placeholder.
5659
* @note added in 1.9
5760
* @note not available in python bindings

‎src/core/qgsattributeaction.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ void QgsAttributeAction::addAction( QgsAction::ActionType type, QString name, QS
4545
mActions << QgsAction( type, name, action, capture );
4646
}
4747

48+
void QgsAttributeAction::removeAction( int index )
49+
{
50+
if ( index >= 0 && index < mActions.size() )
51+
{
52+
mActions.removeAt( index );
53+
}
54+
}
55+
4856
void QgsAttributeAction::doAction( int index, QgsFeature &feat, int defaultValueIndex )
4957
{
5058
QMap<QString, QVariant> substitutionMap;

‎src/core/qgsattributeaction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ class CORE_EXPORT QgsAttributeAction
109109
// dialog box.
110110
void addAction( QgsAction::ActionType type, QString name, QString action, bool capture = false );
111111

112+
//! Remove an action at given index
113+
void removeAction( int index );
114+
112115
/*! Does the given values. defaultValueIndex is the index of the
113116
* field to be used if the action has a $currfield placeholder.
114117
* @note added in 1.9

0 commit comments

Comments
 (0)
Please sign in to comment.