QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
15 #ifndef QGSPROPERTYCOLLECTION_H
16 #define QGSPROPERTYCOLLECTION_H
18 #include "qgis_core.h"
47 sipType = sipType_QgsPropertyCollection;
49 sipType = sipType_QgsPropertyCollectionStack;
51 sipType = sipType_QgsAbstractPropertyCollection;
69 QString
name()
const {
return mName; }
75 void setName(
const QString &name ) { mName = name; }
80 virtual QSet<int> propertyKeys()
const = 0;
85 virtual void clear() = 0;
93 virtual bool hasProperty(
int key )
const = 0;
120 virtual QVariant value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const = 0;
138 QDateTime valueAsDateTime(
int key,
const QgsExpressionContext &context,
const QDateTime &defaultDateTime = QDateTime(),
bool *ok
SIP_OUT =
nullptr )
const;
155 QString valueAsString(
int key,
const QgsExpressionContext &context,
const QString &defaultString = QString(),
bool *ok
SIP_OUT =
nullptr )
const;
172 QColor valueAsColor(
int key,
const QgsExpressionContext &context,
const QColor &defaultColor = QColor(),
bool *ok
SIP_OUT =
nullptr )
const;
246 virtual bool isActive(
int key )
const = 0;
253 virtual bool hasActiveProperties()
const = 0;
260 virtual bool hasDynamicProperties()
const = 0;
344 void clear()
override;
357 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
360 bool isActive(
int key )
const override;
375 void setProperty(
int key,
const QgsProperty &property );
384 void setProperty(
int key,
const QVariant &value );
388 QHash<int, QgsProperty> mProperties;
390 mutable bool mDirty =
false;
391 mutable bool mHasActiveProperties =
false;
392 mutable bool mHasDynamicProperties =
false;
393 mutable int mCount = 0;
432 void clear()
override;
484 bool isActive(
int key )
const override;
504 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
525 QList< QgsPropertyCollection * > mStack;
529 #endif // QGSPROPERTYCOLLECTION_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A store for object properties.
virtual void clear()=0
Removes all properties from the collection.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
virtual bool isActive(int key) const =0
Returns true if the collection contains an active property with the specified key.
Abstract base class for QgsPropertyCollection like objects.
virtual bool hasActiveProperties() const =0
Returns true if the collection has any active properties, or false if all properties within the colle...
virtual bool loadVariant(const QVariant &configuration, const QgsPropertiesDefinition &definitions)=0
Loads this property collection from a QVariantMap, wrapped in a QVariant.
void setName(const QString &name)
Sets the descriptive name for the property collection.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
virtual bool hasDynamicProperties() const =0
Returns true if the collection has any active, non-static properties, or false if either all non-stat...
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
virtual bool hasProperty(int key) const =0
Returns true if the collection contains a property with the specified key.
QString name() const
Returns the descriptive name of the property collection.
virtual QgsProperty property(int key) const =0
Returns a matching property from the collection, if one exists.
virtual QSet< int > propertyKeys() const =0
Returns a list of property keys contained within the collection.
virtual bool prepare(const QgsExpressionContext &context=QgsExpressionContext()) const =0
Prepares the collection against a specified expression context.
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.
virtual QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext(), bool ignoreContext=false) const =0
Returns the set of any fields referenced by the active properties from the collection.
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.
An ordered stack of QgsPropertyCollection containers, where collections added later to the stack will...