Class: QgsProjectProperty¶
-
class
qgis.core.
QgsProjectProperty
¶ Bases:
sip.wrapper
An Abstract Base Class for QGIS project property hierarchys.
Each sub-class is either a
QgsProjectPropertyKey
orQgsProjectPropertyValue
.QgsProjectPropertyKey
can contain eitherQgsProjectPropertyKey
orQgsProjectPropertyValues
, thus describing an hierarchy.QgsProjectPropertyValues
are always graph leaves.Note
This class is used internally by
QgsProject
. It’s generally recommended that the methods inQgsProject
are used to modify project properties rather than using these low-level classes.Methods
Dumps out the keys and values
Returns true if the property is a QgsProjectPropertyKey.
Returns true if property is a leaf node.
Returns true if the property is a QgsProjectPropertyValue.
Restores the property hierarchy from a specified DOM node.
Returns the node’s value.
Writes the property hierarchy to a specified DOM element.
-
dump
(self, tabs: int = 0)¶ Dumps out the keys and values
- Parameters
tabs (int = 0) – is number of tabs to print; used for pretty-printing hierarchy
-
isKey
(self) → bool¶ Returns true if the property is a QgsProjectPropertyKey.
See also
See also
- Return type
bool
-
isLeaf
(self) → bool¶ Returns true if property is a leaf node.
A leaf node is a key node that has either no value or only a single value. A non-leaf node would be a key node with key sub-nodes.
This is used for entryList() and subkeyList() implementation.
- Return type
bool
-
isValue
(self) → bool¶ Returns true if the property is a QgsProjectPropertyValue.
See also
See also
- Return type
bool
-
readXml
(self, keyNode: QDomNode) → bool¶ Restores the property hierarchy from a specified DOM node.
Used for restoring properties from project file
- Parameters
keyNode (QDomNode) –
- Return type
bool
-
value
(self) → Any¶ Returns the node’s value.
For
QgsProjectPropertyValue
nodes, this is straightforward – just return the embedded QVariant, _value. ForQgsProjectPropertyKey
, this means returning theQgsProjectPropertyValue
_value that is keyed by its name, if it exists; i.e.,QgsProjectPropertyKey
“foo” will return the property value mapped to its name, “foo”, in its QHash of QProperties.- Return type
Any
-
writeXml
(self, nodeName: str, element: QDomElement, document: QDomDocument) → bool¶ Writes the property hierarchy to a specified DOM element.
Used for saving properties to project file.
- Parameters
nodeName (str) – the tag name associated with this element
element (QDomElement) – the parent (or encompassing) property element
document (QDomDocument) – the overall project file Dom document
- Return type
bool
-