QGIS API Documentation
3.0.2-Girona (307d082)
|
An ordered stack of QgsPropertyCollection containers, where collections added later to the stack will take priority over earlier collections. More...
#include <qgspropertycollection.h>
Public Member Functions | |
QgsPropertyCollectionStack ()=default | |
Constructor for QgsPropertyCollectionStack. More... | |
QgsPropertyCollectionStack (const QgsPropertyCollectionStack &other) | |
Copy constructor. More... | |
~QgsPropertyCollectionStack () override | |
void | appendCollection (QgsPropertyCollection *collection) |
Appends a collection to the end of the stack, and transfers ownership of the collection to the stack. More... | |
QgsPropertyCollection * | at (int index) |
Returns the collection at the corresponding index from the stack. More... | |
const QgsPropertyCollection * | at (int index) const |
Returns the collection at the corresponding index from the stack. More... | |
void | clear () override |
Removes all collections from the stack. More... | |
QgsPropertyCollection * | collection (const QString &name) |
Returns the first collection with a matching name from the stack. More... | |
int | count () const |
Returns the number of collections contained within the stack. More... | |
bool | hasActiveProperties () const override |
Returns true if the collection has any active properties, or false if all properties within the collection are deactivated. More... | |
bool | hasDynamicProperties () const override |
Returns true if the collection has any active, non-static properties, or false if either all non-static properties within the collection are deactivated or if the collection only contains static properties. More... | |
bool | hasProperty (int key) const override |
Returns true if the collection contains a property with the specified key. More... | |
bool | isActive (int key) const override |
Returns true if the stack contains an active property with the specified key. More... | |
bool | loadVariant (const QVariant &collection, const QgsPropertiesDefinition &definitions) override |
Loads this property collection from a QVariantMap, wrapped in a QVariant. More... | |
QgsPropertyCollectionStack & | operator= (const QgsPropertyCollectionStack &other) |
bool | prepare (const QgsExpressionContext &context=QgsExpressionContext()) const override |
Prepares the collection against a specified expression context. More... | |
QgsProperty | property (int key) const override |
Returns the highest priority property with a matching key from within the stack. More... | |
QSet< int > | propertyKeys () const override |
Returns a list of property keys contained within the collection. More... | |
QSet< QString > | referencedFields (const QgsExpressionContext &context=QgsExpressionContext()) const override |
Returns the set of any fields referenced by the active properties from the stack. More... | |
QVariant | toVariant (const QgsPropertiesDefinition &definitions) const override |
Saves this property collection to a QVariantMap, wrapped in a QVariant. More... | |
QVariant | value (int key, const QgsExpressionContext &context, const QVariant &defaultValue=QVariant()) const override |
Returns the calculated value of the highest priority property with the specified key from within the stack. More... | |
Public Member Functions inherited from QgsAbstractPropertyCollection | |
QgsAbstractPropertyCollection (const QString &name=QString()) | |
Constructor for QgsAbstractPropertyCollection. More... | |
virtual | ~QgsAbstractPropertyCollection ()=default |
QString | name () const |
Returns the descriptive name of the property collection. More... | |
virtual bool | readXml (const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) |
Reads property collection state from an XML element. More... | |
void | setName (const QString &name) |
Sets the descriptive name for the property collection. More... | |
bool | valueAsBool (int key, const QgsExpressionContext &context, bool defaultValue=false, bool *ok=nullptr) const |
Calculates the current value of the property with the specified key and interprets it as an boolean. More... | |
QColor | valueAsColor (int key, const QgsExpressionContext &context, const QColor &defaultColor=QColor(), bool *ok=nullptr) const |
Calculates the current value of the property with the specified key and interprets it as a color. More... | |
double | valueAsDouble (int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const |
Calculates the current value of the property with the specified key and interprets it as a double. More... | |
int | valueAsInt (int key, const QgsExpressionContext &context, int defaultValue=0, bool *ok=nullptr) const |
Calculates the current value of the property with the specified key and interprets it as an integer. More... | |
QString | valueAsString (int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const |
Calculates the current value of the property with the specified key and interprets it as a string. More... | |
virtual bool | writeXml (QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const |
Writes the current state of the property collection into an XML element. More... | |
An ordered stack of QgsPropertyCollection containers, where collections added later to the stack will take priority over earlier collections.
Definition at line 367 of file qgspropertycollection.h.
|
default |
Constructor for QgsPropertyCollectionStack.
|
override |
Definition at line 359 of file qgspropertycollection.cpp.
QgsPropertyCollectionStack::QgsPropertyCollectionStack | ( | const QgsPropertyCollectionStack & | other | ) |
Copy constructor.
Definition at line 364 of file qgspropertycollection.cpp.
void QgsPropertyCollectionStack::appendCollection | ( | QgsPropertyCollection * | collection | ) |
Appends a collection to the end of the stack, and transfers ownership of the collection to the stack.
Properties from the newly added collection will take priority over any existing properties with the same name.
collection | collection to append. Ownership is transferred to the stack. |
Definition at line 399 of file qgspropertycollection.cpp.
QgsPropertyCollection * QgsPropertyCollectionStack::at | ( | int | index | ) |
Returns the collection at the corresponding index from the stack.
index | position of collection, 0 based |
Definition at line 404 of file qgspropertycollection.cpp.
const QgsPropertyCollection * QgsPropertyCollectionStack::at | ( | int | index | ) | const |
Returns the collection at the corresponding index from the stack.
index | position of collection, 0 based |
Definition at line 409 of file qgspropertycollection.cpp.
|
overridevirtual |
Removes all collections from the stack.
Implements QgsAbstractPropertyCollection.
Definition at line 393 of file qgspropertycollection.cpp.
QgsPropertyCollection * QgsPropertyCollectionStack::collection | ( | const QString & | name | ) |
Returns the first collection with a matching name from the stack.
name | name of collection to find |
Definition at line 414 of file qgspropertycollection.cpp.
int QgsPropertyCollectionStack::count | ( | ) | const |
Returns the number of collections contained within the stack.
Definition at line 388 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns true if the collection has any active properties, or false if all properties within the collection are deactivated.
Implements QgsAbstractPropertyCollection.
Definition at line 424 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns true if the collection has any active, non-static properties, or false if either all non-static properties within the collection are deactivated or if the collection only contains static properties.
Implements QgsAbstractPropertyCollection.
Definition at line 434 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns true if the collection contains a property with the specified key.
key | integer key for property. The intended use case is that a context specific enum is cast to int and used for the key value. |
Implements QgsAbstractPropertyCollection.
Definition at line 506 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns true if the stack contains an active property with the specified key.
key | integer key for property to test. The intended use case is that a context specific enum is cast to int and used for the key value. |
Implements QgsAbstractPropertyCollection.
Definition at line 444 of file qgspropertycollection.cpp.
|
overridevirtual |
Loads this property collection from a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils::readVariant to save it to an XML document.
Implements QgsAbstractPropertyCollection.
Definition at line 534 of file qgspropertycollection.cpp.
QgsPropertyCollectionStack & QgsPropertyCollectionStack::operator= | ( | const QgsPropertyCollectionStack & | other | ) |
Definition at line 375 of file qgspropertycollection.cpp.
|
overridevirtual |
Prepares the collection against a specified expression context.
Calling prepare before evaluating the collection's properties multiple times allows precalculation of expensive setup tasks such as parsing expressions. Returns true if preparation was successful.
Implements QgsAbstractPropertyCollection.
Definition at line 486 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns the highest priority property with a matching key from within the stack.
key | integer key for property to return. The intended use case is that a context specific enum is cast to int and used for the key value. |
Implements QgsAbstractPropertyCollection.
Definition at line 449 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns a list of property keys contained within the collection.
Implements QgsAbstractPropertyCollection.
Definition at line 496 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns the set of any fields referenced by the active properties from the stack.
context | expression context the properties will be evaluated against. |
Implements QgsAbstractPropertyCollection.
Definition at line 476 of file qgspropertycollection.cpp.
|
overridevirtual |
Saves this property collection to a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils::writeVariant to save it to an XML document.
Implements QgsAbstractPropertyCollection.
Definition at line 516 of file qgspropertycollection.cpp.
|
overridevirtual |
Returns the calculated value of the highest priority property with the specified key from within the stack.
key | integer key for property to calculate. The intended use case is that a context specific enum is cast to int and used for the key value. |
context | expression context to evaluate property against |
defaultValue | default value to return if no matching, active property found or if the property value cannot be calculated |
Implements QgsAbstractPropertyCollection.
Definition at line 466 of file qgspropertycollection.cpp.