Class: QgsProjectPropertyKey¶
- class qgis.core.QgsProjectPropertyKey¶
Bases:
QgsProjectProperty
Project property key node.
Can, itself, contain
QgsProjectPropertyKey
andQgsProjectPropertyValues
.The internal QHash, mProperties, maps key names to their respective
QgsProjectPropertyValue
or nextQgsProjectPropertyKey
in the key name sequence. The key with the current name should contain its QgsProjectPropertyValue.E.g., given the key sequence “/foo/bar”, “foo” will have a corresponding
QgsProjectPropertyKey
with a name “foo”. It will contain an element in its mProperties that maps to “bar”, which is anotherQgsProjectPropertyKey
. The “bar”QgsProjectPropertyKey
will, in turn, have an element that maps to itself, i.e. “bar”, that will contain a QgsProjectPropertyValue.QgsProjectPropertyKey(name: str = ‘’) Create a new
QgsProjectPropertyKey
with the specified identifier.QgsProjectPropertyKey(
QgsProjectPropertyKey
)Methods
Adds the specified property key as a sub-key.
Resets the property to a default, empty state.
Deletes any sub-nodes from the property.
Returns the number of sub-keys contained by this property.
- param tabs:
Returns any sub-keys contained by this property that do not contain other keys.
Attempts to find a property with a matching sub-key name.
Returns
True
if this property contains no sub-keys.- rtype:
bool
- rtype:
bool
- rtype:
bool
The name of the property is used as identifier.
- param keyNode:
Removes the specified key.
The name of the property is used as identifier.
Sets the value associated with this key.
Returns any sub-keys contained by this property which themselves contain other keys.
If this key has a value, it will be stored by its name in its properties
- param nodeName:
- addKey(self, keyName: str) QgsProjectPropertyKey ¶
Adds the specified property key as a sub-key.
- Parameters:
keyName (str) –
- Return type:
- clear(self)¶
Resets the property to a default, empty state.
- clearKeys(self)¶
Deletes any sub-nodes from the property.
- count(self) int ¶
Returns the number of sub-keys contained by this property.
- Return type:
int
- dump(self, tabs: int = 0)¶
- Parameters:
tabs (int = 0) –
- entryList(self, entries: Iterable[str])¶
Returns any sub-keys contained by this property that do not contain other keys.
See also
- Parameters:
entries (Iterable[str]) –
- find(self, propertyName: str) QgsProjectProperty ¶
Attempts to find a property with a matching sub-key name.
- Parameters:
propertyName (str) –
- Return type:
- isEmpty(self) bool ¶
Returns
True
if this property contains no sub-keys.- Return type:
bool
- isKey(self) bool ¶
- Return type:
bool
- isLeaf(self) bool ¶
- Return type:
bool
- isValue(self) bool ¶
- Return type:
bool
- name(self) str ¶
The name of the property is used as identifier.
See also
- Return type:
str
- readXml(self, keyNode: QDomNode) bool ¶
- Parameters:
keyNode (QDomNode) –
- Return type:
bool
- removeKey(self, keyName: str)¶
Removes the specified key.
- Parameters:
keyName (str) –
- setName(self, name: str)¶
The name of the property is used as identifier.
See also
- Parameters:
name (str) –
- setValue(self, name: str, value: Any) QgsProjectPropertyValue ¶
Sets the value associated with this key.
- Parameters:
name (str) – is the key name
value (Any) – is the value to set
- Return type:
- Returns:
pointer to property value
setValue(self, value: Any) -> QgsProjectPropertyValue Set the value associated with this key
Note
that the single value node associated with each key is always stored keyed by the current key name
- subkeyList(self, entries: Iterable[str])¶
Returns any sub-keys contained by this property which themselves contain other keys.
See also
- Parameters:
entries (Iterable[str]) –
- value(self) Any ¶
If this key has a value, it will be stored by its name in its properties
- Return type:
Any
- writeXml(self, nodeName: str, element: QDomElement, document: QDomDocument) bool ¶
- Parameters:
nodeName (str) –
element (QDomElement) –
document (QDomDocument) –
- Return type:
bool