Class: QgsPropertyCollectionStack¶
-
class
qgis.core.
QgsPropertyCollectionStack
¶ Bases:
qgis._core.QgsAbstractPropertyCollection
Constructor for QgsPropertyCollectionStack.
QgsPropertyCollectionStack(other: QgsPropertyCollectionStack) Copy constructor
An ordered stack of QgsPropertyCollection containers, where collections added later to the stack will take priority over earlier collections.
New in version 3.0: Enums
Methods
Appends a collection to the end of the stack, and transfers ownership of the collection to the stack.
Returns the collection at the corresponding index from the stack.
Removes all collections from the stack.
Returns the first collection with a matching name from the stack.
Returns the number of collections contained within the stack.
Returns true if the collection has any active properties, or false if all properties within the collection are deactivated.
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.
Returns true if the stack contains an active property with the specified key.
Returns the highest priority property with a matching key from within the stack.
Returns the set of any fields referenced by the active properties from the stack.
Returns the calculated value of the highest priority property with the specified key from within the stack.
Signals
Attributes
-
appendCollection
(self, collection: QgsPropertyCollection)¶ 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.
- Parameters
collection – collection to append. Ownership is transferred to the stack.
-
at
(self, index: int) → QgsPropertyCollection¶ Returns the collection at the corresponding index from the stack.
- Parameters
index – position of collection, 0 based
- Returns
collection if one exists at the specified index
-
clear
(self)¶ Removes all collections from the stack.
-
collection
(self, name: str) → QgsPropertyCollection¶ Returns the first collection with a matching name from the stack.
- Parameters
name – name of collection to find
- Returns
collection if one exists with the specified name
-
count
(self) → int¶ Returns the number of collections contained within the stack.
-
hasActiveProperties
(self) → bool¶ Returns true if the collection has any active properties, or false if all properties within the collection are deactivated.
See also
See also
-
hasDynamicProperties
(self) → bool¶ 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.
See also
-
hasProperty
(self, key: int) → bool¶
-
isActive
(self, key: int) → bool¶ Returns true if the stack contains an active property with the specified key.
- Parameters
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.
See also
-
loadVariant
(self, collection: Any, definitions: object) → bool¶
-
prepare
(self, context: QgsExpressionContext = QgsExpressionContext()) → bool¶
-
property
(self, key: int) → QgsProperty¶ Returns the highest priority property with a matching key from within the stack.
- Parameters
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.
- Returns
matching property, or null if no matching, active property found.
See also
hasActiveProperty()
-
propertyKeys
(self) → object¶
-
referencedFields
(self, context: QgsExpressionContext = QgsExpressionContext()) → Set[str]¶ Returns the set of any fields referenced by the active properties from the stack.
- Parameters
context – expression context the properties will be evaluated against.
-
toVariant
(self, definitions: object) → Any¶
-
value
(self, key: int, context: QgsExpressionContext, defaultValue: Any = None) → Any¶ Returns the calculated value of the highest priority property with the specified key from within the stack.
- Parameters
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
- Returns
calculated property value, or default value if property could not be evaluated
-