Class: QgsPropertyCollection¶
-
class
qgis.core.
QgsPropertyCollection
(name: str = '')¶ Bases:
QgsAbstractPropertyCollection
Constructor for QgsPropertyCollection
- Parameters
name (str = '') – collection name
QgsPropertyCollection(other:
QgsPropertyCollection
) Copy constructor.A grouped map of multiple
QgsProperty
objects, each referenced by a integer key value.Properties within a collection are referenced by an integer key. This is done to avoid the cost of string creation and comparisons which would be required by a string key. The intended use case is that a context specific enum is cast to int and used for the key value. Examples of such enums are :
See also
See also
QgsPalLabeling.Property()
See also
QgsAbstract3DSymbol.Property()
See also
See also
See also
QgsWidgetWrapper.Property()
Methods
Returns the number of properties contained within the collection.
- rtype
bool
- rtype
bool
- param key
- param key
- param configuration
- param context
Returns a reference to a matching property from the collection, if one exists.
- rtype
object
- param context
Adds a property to the collection and takes ownership of it.
- param definitions
- param key
-
clear
(self)¶
-
count
(self) → int¶ Returns the number of properties contained within the collection.
- Return type
int
-
hasActiveProperties
(self) → bool¶ - Return type
bool
-
hasDynamicProperties
(self) → bool¶ - Return type
bool
-
hasProperty
(self, key: int) → bool¶ - Parameters
key (int) –
- Return type
bool
-
isActive
(self, key: int) → bool¶ - Parameters
key (int) –
- Return type
bool
-
loadVariant
(self, configuration: Any, definitions: Dict[int, QgsPropertyDefinition]) → bool¶ - Parameters
configuration (Any) –
definitions (Dict[int) –
- Return type
bool
-
prepare
(self, context: QgsExpressionContext = QgsExpressionContext()) → bool¶ - Parameters
context (
QgsExpressionContext
= QgsExpressionContext()) –- Return type
bool
-
property
(self, key: int) → QgsProperty¶ Returns a reference to a matching property from the collection, if one exists.
- Parameters
key (int) – 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.
- Return type
- Returns
matching property, or null if no matching, active property found.
See also
-
propertyKeys
(self) → object¶ - Return type
object
-
referencedFields
(self, context: QgsExpressionContext = QgsExpressionContext(), ignoreContext: bool = False) → Set[str]¶ - Parameters
context (
QgsExpressionContext
= QgsExpressionContext()) –ignoreContext (bool = False) –
- Return type
Set[str]
-
setProperty
(self, key: int, property: QgsProperty)¶ Adds a property to the collection and takes ownership of it.
- Parameters
key (int) – integer key for property. Any existing property with the same key will be removed and replaced by this property. The intended use case is that a context specific enum is cast to int and used for the key value.
property (QgsProperty) – property to add. Ownership is transferred to the collection. Setting an invalid property will remove the property from the collection.
setProperty(self, key: int, value: Any) Convenience method, creates a
QgsStaticProperty
and stores it within the collection.- Parameters
key – integer key for property. Any existing property with the same key will be deleted and replaced by this property. The intended use case is that a context specific enum is cast to int and used for the key value.
value – static value for property
-
toVariant
(self, definitions: Dict[int, QgsPropertyDefinition]) → Any¶ - Parameters
definitions (Dict[int) –
- Return type
Any
-
value
(self, key: int, context: QgsExpressionContext, defaultValue: Any = None) → Any¶ - Parameters
key (int) –
context (QgsExpressionContext) –
defaultValue (Any = None) –
- Return type
Any