19#include "moc_qgsstoredexpressionmanager.cpp"
41 mStoredExpressions.removeAt( i );
57 newStoredExpression.
name = name;
59 newStoredExpression.
tag = tag;
60 mStoredExpressions.replace( i, newStoredExpression );
113 mStoredExpressions.clear();
118 QDomElement aStoredExpressions = layerNode.ownerDocument().createElement( QStringLiteral(
"storedexpressions" ) );
122 QDomElement aStoredExpression = layerNode.ownerDocument().createElement( QStringLiteral(
"storedexpression" ) );
126 aStoredExpressions.appendChild( aStoredExpression );
128 layerNode.appendChild( aStoredExpressions );
137 QDomNode aaNode = layerNode.namedItem( QStringLiteral(
"storedexpressions" ) );
139 if ( !aaNode.isNull() )
141 QDomNodeList aStoredExpressions = aaNode.toElement().elementsByTagName( QStringLiteral(
"storedexpression" ) );
142 for (
int i = 0; i < aStoredExpressions.size(); ++i )
144 QDomElement aStoredExpression = aStoredExpressions.at( i ).toElement();
145 addStoredExpression( aStoredExpression.attribute( QStringLiteral(
"name" ) ), aStoredExpression.attribute( QStringLiteral(
"expression" ) ),
QgsStoredExpression::Category( aStoredExpression.attribute( QStringLiteral(
"tag" ) ).toInt() ) );
void removeStoredExpression(const QString &id)
Removes an expression to the list.
QgsStoredExpression storedExpression(const QString &id) const
Returns an expression according to the id.
bool writeXml(QDomNode &layerNode) const
Writes the stored expressions out in XML format.
void clearStoredExpressions()
Clears list of stored expressions.
QgsStoredExpression findStoredExpressionByExpression(const QString &expression, const QgsStoredExpression::Category &tag=QgsStoredExpression::Category::All) const
Returns an expression according to the expression text.
QList< QgsStoredExpression > storedExpressions(const QgsStoredExpression::Category &tag=QgsStoredExpression::Category::All)
Returns the list of named expressions.
void addStoredExpressions(const QList< QgsStoredExpression > &storedExpressions)
Appends a list of expressions to the existing list.
void updateStoredExpression(const QString &id, const QString &name, const QString &expression, const QgsStoredExpression::Category &tag)
Updates an expression by id.
bool readXml(const QDomNode &layerNode)
Reads the stored expressions in in XML format.
QString addStoredExpression(const QString &name, const QString &expression, const QgsStoredExpression::Category &tag=QgsStoredExpression::Category::FilterExpression)
Adds an expression to the list.
Stored expression containing name, content (expression text) and a category tag.
QString expression
expression text
Category
Categories of use cases FilterExpression for stored expressions to filter attribute table DefaultValu...
QString id
generated uuid used for identification
Category tag
category of the expression use case
QString name
descriptive name of the expression