27 , mComposition( composition )
52 qDeleteAll( mDataDefinedProperties );
98 if ( it != mDataDefinedProperties.
constEnd() )
115 bool defaultVals = ( !active && !useExpression && expression.
isEmpty() && field.
isEmpty() );
117 if ( mDataDefinedProperties.
contains( property ) )
120 if ( it != mDataDefinedProperties.
constEnd() )
129 else if ( !defaultVals )
132 mDataDefinedProperties.
insert( property, dd );
143 Q_UNUSED( property );
155 return mComposition->dataDefinedEvaluate( property, expressionValue, context, &mDataDefinedProperties );
158 void QgsComposerObject::prepareDataDefinedExpressions()
const 164 if ( it != mDataDefinedProperties.
constEnd() )
166 it.
value()->prepareExpression( *context.
data() );
void setActive(bool active)
QVariant customProperty(const QString &key, const QVariant &defaultValue=QVariant()) const
Read a custom property from the object.
A container class for data source field mapping or expression.
bool contains(const Key &key) const
QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the compositions's current state.
QStringList customProperties() const
Return list of keys stored in custom properties for the object.
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from XML.
QgsObjectCustomProperties mCustomProperties
Custom properties for object.
virtual ~QgsComposerObject()
const_iterator constBegin() const
static void readDataDefinedPropertyMap(const QDomElement &itemElem, QMap< QgsComposerObject::DataDefinedProperty, QString > *dataDefinedNames, QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined * > *dataDefinedProperties)
Reads all data defined properties from xml.
QMap< QgsComposerObject::DataDefinedProperty, QString > mDataDefinedNames
Map of data defined properties for the item to string name to use when exporting item to xml...
virtual void refreshDataDefinedProperty(const DataDefinedProperty property=AllProperties, const QgsExpressionContext *context=nullptr)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Return value for the given key. If the key is not stored, default value will be used.
const_iterator constFind(const Key &key) const
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
void writeXml(QDomNode &parentNode, QDomDocument &doc) const
Write store contents to XML.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static void writeDataDefinedPropertyMap(QDomElement &itemElem, QDomDocument &doc, const QMap< QgsComposerObject::DataDefinedProperty, QString > *dataDefinedNames, const QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined * > *dataDefinedProperties)
Writes data defined properties to xml.
void remove(const QString &key)
Remove a key (entry) from the store.
DataDefinedProperty
Data defined properties for different item types.
QgsComposerObject(QgsComposition *composition)
Constructor.
void setUseExpression(bool use)
Controls if the field or the expression part is active.
void setValue(const QString &key, const QVariant &value)
Add an entry to the store. If the entry with the keys exists already, it will be overwritten.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
QVariant property(const char *name) const
void setField(const QString &field)
Set the field name which this QgsDataDefined represents.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
const_iterator constEnd() const
bool dataDefinedEvaluate(const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue, const QgsExpressionContext &context=QgsExpressionContext()) const
Evaluate a data defined property and return the calculated value.
void removeCustomProperty(const QString &key)
Remove a custom property from the object.
virtual void repaint()
Triggers a redraw for the item.
QStringList keys() const
Return list of stored keys.
Graphics scene for map printing.
QgsDataDefined * dataDefinedProperty(const DataDefinedProperty property) const
Returns a reference to the data defined settings for one of the item's data defined properties...
QgsComposition * mComposition
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
void setCustomProperty(const QString &key, const QVariant &value)
Set a custom property for the object.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setDataDefinedProperty(const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field)
Sets parameters for a data defined property for the item.
QgsAtlasComposition & atlasComposition()
iterator insert(const Key &key, const T &value)
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Represents a vector layer which manages a vector based data sets.
void setExpressionString(const QString &expr)
Sets the expression for this QgsDataDefined.
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects' current state.