QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
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;
341 void clear()
override;
354 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
357 bool isActive(
int key )
const override;
372 void setProperty(
int key,
const QgsProperty &property );
381 void setProperty(
int key,
const QVariant &value );
385 QHash<int, QgsProperty> mProperties;
387 mutable bool mDirty =
false;
388 mutable bool mHasActiveProperties =
false;
389 mutable bool mHasDynamicProperties =
false;
390 mutable int mCount = 0;
429 void clear()
override;
481 bool isActive(
int key )
const override;
501 QVariant
value(
int key,
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant() )
const override;
522 QList< QgsPropertyCollection * > mStack;
526 #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.
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.
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...