15 #ifndef QGSPROPERTYCOLLECTION_H 16 #define QGSPROPERTYCOLLECTION_H 18 #include "qgis_core.h" 44 if ( dynamic_cast<QgsPropertyCollection *>( sipCpp ) )
45 sipType = sipType_QgsPropertyCollection;
46 else if ( dynamic_cast<QgsPropertyCollectionStack *>( sipCpp ) )
47 sipType = sipType_QgsPropertyCollectionStack;
49 sipType = sipType_QgsAbstractPropertyCollection;
67 QString
name()
const {
return mName; }
73 void setName(
const QString &name ) { mName = name; }
78 virtual QSet<int> propertyKeys()
const = 0;
83 virtual void clear() = 0;
91 virtual bool hasProperty(
int key )
const = 0;
118 virtual QVariant value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const = 0;
134 QString valueAsString(
int key,
const QgsExpressionContext &context,
const QString &defaultString = QString(),
bool *ok
SIP_OUT =
nullptr )
const;
150 QColor valueAsColor(
int key,
const QgsExpressionContext &context,
const QColor &defaultColor = QColor(),
bool *ok
SIP_OUT =
nullptr )
const;
218 virtual bool isActive(
int key )
const = 0;
225 virtual bool hasActiveProperties()
const = 0;
232 virtual bool hasDynamicProperties()
const = 0;
313 void clear()
override;
326 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
329 bool isActive(
int key )
const override;
344 void setProperty(
int key,
const QgsProperty &property );
353 void setProperty(
int key,
const QVariant &value );
357 QHash<int, QgsProperty> mProperties;
359 mutable bool mDirty =
false;
360 mutable bool mHasActiveProperties =
false;
361 mutable bool mHasDynamicProperties =
false;
362 mutable int mCount = 0;
401 void clear()
override;
453 bool isActive(
int key )
const override;
473 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
491 QList< QgsPropertyCollection * > mStack;
495 #endif // QGSPROPERTYCOLLECTION_H virtual bool hasActiveProperties() const =0
Returns true if the collection has any active properties, or false if all properties within the colle...
virtual void clear()=0
Removes all properties from the collection.
virtual bool loadVariant(const QVariant &configuration, const QgsPropertiesDefinition &definitions)=0
Loads this property collection from a QVariantMap, wrapped in a QVariant.
virtual QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext()) const =0
Returns the set of any fields referenced by the active properties from the collection.
virtual bool isActive(int key) const =0
Returns true if the collection contains an active property with the specified key.
void setName(const QString &name)
Sets the descriptive name for the property collection.
virtual QSet< int > propertyKeys() const =0
Returns a list of property keys contained within the collection.
virtual bool hasProperty(int key) const =0
Returns true if the collection contains a property with the specified key.
virtual bool hasDynamicProperties() const =0
Returns true if the collection has any active, non-static properties, or false if either all non-stat...
An ordered stack of QgsPropertyCollection containers, where collections added later to the stack will...
virtual bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const =0
Prepares the collection against a specified expression context.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for QgsPropertyCollection like objects.
virtual QgsProperty property(int key) const =0
Returns a matching property from the collection, if one exists.
A store for object properties.
QString name() const
Returns the descriptive name of the property collection.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
virtual QVariant value(int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const =0
Returns the calculated value of the property with the specified key from within the collection...
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
virtual QVariant toVariant(const QgsPropertiesDefinition &definitions) const =0
Saves this property collection to a QVariantMap, wrapped in a QVariant.