remove expression functionality identified by name

This commit is contained in:
David Signer 2019-08-19 16:54:28 +02:00
parent 7f93ac6e14
commit d11f4e6b76
3 changed files with 32 additions and 0 deletions

View File

@ -42,6 +42,14 @@ Adds an expression to the list
:param name: optional name of the expression
:param expression: the expression content
:param tag: some content, maybe scope where to be shown
%End
void removeStoredExpression( const QString &name, const QString &tag = QString() );
%Docstring
Removes an expression to the list
:param name: name of the expression as identification
:param tag: some content, maybe scope where to be shown
%End
void addStoredExpressions( QList< QPair< QString, QString > > namedexpressions, const QString &tag = QString() );

View File

@ -34,6 +34,22 @@ void QgsStoredExpressionManager::addStoredExpression( const QString &name, const
mStoredExpressions.append( storedExpression );
}
void QgsStoredExpressionManager::removeStoredExpression( const QString &name, const QString &tag )
{
Q_UNUSED( tag );
int i = 0;
for ( const QPair<QString, QString> &storedExpression : mStoredExpressions )
{
if ( storedExpression.first == name )
{
mStoredExpressions.removeAt( i );
break;
}
++i;
}
}
void QgsStoredExpressionManager::addStoredExpressions( QList<QPair<QString, QString> > namedexpressions, const QString &tag )
{
Q_UNUSED( tag );

View File

@ -60,6 +60,14 @@ class CORE_EXPORT QgsStoredExpressionManager : public QObject
*/
void addStoredExpression( const QString &name, const QString &expression, const QString &tag = QString() );
/**
* Removes an expression to the list
*
* \param name name of the expression as identification
* \param tag some content, maybe scope where to be shown
*/
void removeStoredExpression( const QString &name, const QString &tag = QString() );
/**
* Appends a list of expressions to the existing list
*