QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | List of all members
QgsDataDefined Class Reference

A container class for data source field mapping or expression. More...

#include <qgsdatadefined.h>

Public Member Functions

 QgsDataDefined (bool active=false, bool useexpr=false, const QString &expr=QString(), const QString &field=QString())
 Construct a new data defined object.
 QgsDataDefined (const QgsExpression *expression)
 Construct a new data defined object, analyse the expression to determine if it's a simple field.
 ~QgsDataDefined ()
QgsExpressionexpression ()
bool expressionIsPrepared () const
QMap< QString, QVariant > expressionParams () const
QString expressionString () const
QString field () const
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.
void insertExpressionParam (QString key, QVariant param)
bool isActive () const
bool operator!= (const QgsDataDefined &other) const
bool operator== (const QgsDataDefined &other) const
bool prepareExpression (QgsVectorLayer *layer)
QStringList referencedColumns (QgsVectorLayer *layer)
void setActive (bool active)
void setExpressionParams (QMap< QString, QVariant > params)
void setExpressionString (const QString &expr)
void setField (const QString &field)
bool setFromXmlElement (const QDomElement &element)
 Sets the properties of the data defined container from an XML element.
void setUseExpression (bool use)
QMap< QString, QString > toMap ()
QDomElement toXmlElement (QDomDocument &document, const QString &elementName) const
 Returns a DOM element containing the properties of the data defined container.
bool useExpression () const

Detailed Description

A container class for data source field mapping or expression.

Definition at line 31 of file qgsdatadefined.h.

Constructor & Destructor Documentation

QgsDataDefined::QgsDataDefined ( bool  active = false,
bool  useexpr = false,
const QString &  expr = QString(),
const QString &  field = QString() 
)

Construct a new data defined object.

Parameters
activeWhether the current data defined is active
useexprWhether to use expression instead of field
exprExpression string
fieldField name string

Definition at line 23 of file qgsdatadefined.cpp.

QgsDataDefined::QgsDataDefined ( const QgsExpression expression)
explicit

Construct a new data defined object, analyse the expression to determine if it's a simple field.

Parameters
expressioncan be null

Definition at line 36 of file qgsdatadefined.cpp.

QgsDataDefined::~QgsDataDefined ( )

Definition at line 46 of file qgsdatadefined.cpp.

Member Function Documentation

QgsExpression* QgsDataDefined::expression ( )
inline

Definition at line 82 of file qgsdatadefined.h.

bool QgsDataDefined::expressionIsPrepared ( ) const
inline

Definition at line 80 of file qgsdatadefined.h.

QMap<QString, QVariant> QgsDataDefined::expressionParams ( ) const
inline

Definition at line 74 of file qgsdatadefined.h.

QString QgsDataDefined::expressionString ( ) const
inline

Definition at line 70 of file qgsdatadefined.h.

QString QgsDataDefined::field ( ) const
inline

Definition at line 85 of file qgsdatadefined.h.

bool QgsDataDefined::hasDefaultValues ( ) const

Returns whether the data defined container is set to all the default values, ie, disabled, with empty expression and no assigned field.

Returns
true if data defined container is set to default values
Note
added in QGIS 2.7

Definition at line 52 of file qgsdatadefined.cpp.

void QgsDataDefined::insertExpressionParam ( QString  key,
QVariant  param 
)

Definition at line 134 of file qgsdatadefined.cpp.

bool QgsDataDefined::isActive ( ) const
inline

Definition at line 64 of file qgsdatadefined.h.

bool QgsDataDefined::operator!= ( const QgsDataDefined other) const

Definition at line 180 of file qgsdatadefined.cpp.

bool QgsDataDefined::operator== ( const QgsDataDefined other) const

Definition at line 174 of file qgsdatadefined.cpp.

bool QgsDataDefined::prepareExpression ( QgsVectorLayer layer)

Definition at line 63 of file qgsdatadefined.cpp.

QStringList QgsDataDefined::referencedColumns ( QgsVectorLayer layer)

Definition at line 112 of file qgsdatadefined.cpp.

void QgsDataDefined::setActive ( bool  active)
inline

Definition at line 65 of file qgsdatadefined.h.

void QgsDataDefined::setExpressionParams ( QMap< QString, QVariant >  params)
inline

Definition at line 76 of file qgsdatadefined.h.

void QgsDataDefined::setExpressionString ( const QString &  expr)

Definition at line 57 of file qgsdatadefined.cpp.

void QgsDataDefined::setField ( const QString &  field)
inline

Definition at line 86 of file qgsdatadefined.h.

bool QgsDataDefined::setFromXmlElement ( const QDomElement &  element)

Sets the properties of the data defined container from an XML element.

Calling this will overwrite all the current properties of the container.

Parameters
elementDOM element
Returns
true if properties were successfully read from element
Note
added in QGIS 2.7
See Also
toXmlElement

Definition at line 160 of file qgsdatadefined.cpp.

void QgsDataDefined::setUseExpression ( bool  use)
inline

Definition at line 68 of file qgsdatadefined.h.

QMap< QString, QString > QgsDataDefined::toMap ( )

Definition at line 139 of file qgsdatadefined.cpp.

QDomElement QgsDataDefined::toXmlElement ( QDomDocument &  document,
const QString &  elementName 
) const

Returns a DOM element containing the properties of the data defined container.

Parameters
documentDOM document
elementNamename for DOM element
Returns
DOM element corresponding to data defined container
Note
added in QGIS 2.7
See Also
setFromXmlElement

Definition at line 150 of file qgsdatadefined.cpp.

bool QgsDataDefined::useExpression ( ) const
inline

Definition at line 67 of file qgsdatadefined.h.


The documentation for this class was generated from the following files: