29   d = 
new QgsDataDefinedPrivate( active, useexpr, expr, field );
    34   bool active = bool( expression );
    36   d = 
new QgsDataDefinedPrivate( active,
    67   return new QgsDataDefined( active, useExpression, expression, field );
    76   d = 
new QgsDataDefinedPrivate( active,
    89   return ( !d->active && !d->useExpression && d->expressionString.isEmpty() && d->field.isEmpty() );
    99   if ( active == d->active )
   108   return d->useExpression;
   113   if ( use == d->useExpression )
   117   d->useExpression = use;
   118   d->expressionPrepared = 
false;
   119   d->exprRefColumns.clear();
   124   return d->expressionString;
   129   if ( expr == d->expressionString )
   134   d->useExpression = 
true;
   135   d->expressionString = expr;
   136   d->expressionPrepared = 
false;
   137   d->exprRefColumns.clear();
   142   return d->useExpression ? d->expressionString : 
QString( 
"\"%1\"" ).
arg( d->field );
   147   return d->expressionParams;
   153   d->expressionParams = params;
   177   if ( !d->useExpression || d->expressionString.isEmpty() )
   183   delete d->expression;
   185   if ( d->expression->hasParserError() )
   187     QgsDebugMsg( 
"Parser error:" + d->expression->parserErrorString() );
   192   QVariant scaleV = d->expressionParams.value( 
"scale" );
   196     double scale = scaleV.
toDouble( &ok );
   199       d->expression->setScale( scale );
   203   d->expression->prepare( &context );
   204   d->exprRefColumns = d->expression->referencedColumns();
   206   if ( d->expression->hasEvalError() )
   208     d->expressionPrepared = 
false;
   209     QgsDebugMsg( 
"Prepare error:" + d->expression->evalErrorString() );
   213   d->expressionPrepared = 
true;
   220   return d->expressionPrepared;
   229   return d->expression;
   252   if ( !d->exprRefColumns.isEmpty() )
   254     return d->exprRefColumns;
   258   if ( d->useExpression )
   260     if ( !d->expression || !d->expressionPrepared )
   265   else if ( !d->field.isEmpty() )
   267     d->exprRefColumns << d->field;
   270   return d->exprRefColumns;
   280   if ( field == d->field )
   284   d->useExpression = 
false;
   286   d->exprRefColumns.clear();
   292   d->expressionParams.insert( key, param );
   304   map.
insert( 
QString( 
"%1active" ).arg( prefix ), ( d->active ? 
"1" : 
"0" ) );
   305   map.
insert( 
QString( 
"%1useexpr" ).arg( prefix ), ( d->useExpression ? 
"1" : 
"0" ) );
   306   map.
insert( 
QString( 
"%1expression" ).arg( prefix ), d->expressionString );
   315   element.
setAttribute( 
"active", d->active ? 
"true" : 
"false" );
   316   element.
setAttribute( 
"useExpr", d->useExpression ? 
"true" : 
"false" );
   330   d->active = element.
attribute( 
"active" ).
compare( 
"true", Qt::CaseInsensitive ) == 0;
   331   d->useExpression = element.
attribute( 
"useExpr" ).
compare( 
"true", Qt::CaseInsensitive ) == 0;
   333   d->expressionString = element.
attribute( 
"expr" );
   334   d->expressionPrepared = 
false;
   335   d->exprRefColumns.clear();
   341   return *( other.d ) == *d;
   346   return !( *
this == other );
 Class for parsing and evaluation of expressions (formerly called "search strings"). 
 
void setExpressionParams(const QMap< QString, QVariant > ¶ms)
 
void setActive(bool active)
 
QgsDataDefined & operator=(QgsDataDefined const &rhs)
Assignment operator. 
 
QString & append(QChar ch)
 
A container class for data source field mapping or expression. 
 
bool contains(const Key &key) const
 
bool expressionIsPrepared() const
Returns whether the data defined object's expression is prepared. 
 
QString attribute(const QString &name, const QString &defValue) const
 
static QgsExpressionContext createFeatureBasedContext(const QgsFeature &feature, const QgsFields &fields)
Helper function for creating an expression context which contains just a feature and fields collectio...
 
virtual QString dump() const =0
Abstract virtual dump method. 
 
QDomElement toXmlElement(QDomDocument &document, const QString &elementName) const
Returns a DOM element containing the properties of the data defined container. 
 
bool operator==(const QgsDataDefined &other) const
 
QgsExpression * expression()
 
Container of fields for a vector layer. 
 
static QgsDataDefined * fromMap(const QgsStringMap &map, const QString &baseName=QString())
Creates a QgsDataDefined from a decoded QgsStringMap. 
 
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
 
QgsStringMap toMap(const QString &baseName=QString()) const
Encodes the QgsDataDefined into a string map. 
 
bool useExpression() const
Returns if the field or the expression part is active. 
 
QgsFields fields() const
Returns the list of fields of this layer. 
 
const Node * rootNode() const
Returns root node of the expression. Root node is null is parsing has failed. 
 
void setUseExpression(bool use)
Controls if the field or the expression part is active. 
 
bool setFromXmlElement(const QDomElement &element)
Sets the properties of the data defined container from an XML element. 
 
void setAttribute(const QString &name, const QString &value)
 
void setField(const QString &field)
Set the field name which this QgsDataDefined represents. 
 
QString expressionString() const
Returns the expression string of this QgsDataDefined. 
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
QString expression() const
Return the original, unmodified expression string. 
 
QString field() const
Get the field which this QgsDataDefined represents. 
 
bool operator!=(const QgsDataDefined &other) const
 
QgsDataDefined(bool active=false, bool useexpr=false, const QString &expr=QString(), const QString &field=QString())
Construct a new data defined object. 
 
Q_DECL_DEPRECATED bool prepareExpression(QgsVectorLayer *layer)
Prepares the expression using a vector layer. 
 
bool isField() const
Checks whether an expression consists only of a single field reference. 
 
void insertExpressionParam(const QString &key, const QVariant ¶m)
 
QString expressionOrField() const
Returns an expression which represents a single field if useExpression returns false, otherwise returns the current expression string. 
 
double toDouble(bool *ok) const
 
iterator insert(const Key &key, const T &value)
 
QDomElement createElement(const QString &tagName)
 
bool hasDefaultValues() const
Returns whether the data defined container is set to all the default values, ie, disabled, with empty expression and no assigned field. 
 
Represents a vector layer which manages a vector based data sets. 
 
int compare(const QString &other) const
 
virtual ~QgsDataDefined()
 
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
 
void setExpressionString(const QString &expr)
Sets the expression for this QgsDataDefined. 
 
Q_DECL_DEPRECATED QStringList referencedColumns(QgsVectorLayer *layer)
Returns the columns referenced by the QgsDataDefined. 
 
QMap< QString, QVariant > expressionParams() const
 
const T value(const Key &key) const