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;
116 virtual QVariant value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const = 0;
132 QString valueAsString(
int key,
const QgsExpressionContext &context,
const QString &defaultString = QString(),
bool *ok
SIP_OUT =
nullptr )
const;
148 QColor valueAsColor(
int key,
const QgsExpressionContext &context,
const QColor &defaultColor = QColor(),
bool *ok
SIP_OUT =
nullptr )
const;
216 virtual bool isActive(
int key )
const = 0;
223 virtual bool hasActiveProperties()
const = 0;
230 virtual bool hasDynamicProperties()
const = 0;
303 void clear()
override;
316 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
319 bool isActive(
int key )
const override;
334 void setProperty(
int key,
const QgsProperty &property );
343 void setProperty(
int key,
const QVariant &value );
347 QHash<int, QgsProperty> mProperties;
349 mutable bool mDirty =
false;
350 mutable bool mHasActiveProperties =
false;
351 mutable bool mHasDynamicProperties =
false;
352 mutable int mCount = 0;
391 void clear()
override;
443 bool isActive(
int key )
const override;
463 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
481 QList< QgsPropertyCollection * > mStack;
485 #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.