QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
Public Member Functions | List of all members
QgsProjectProperty Class Referenceabstract

An Abstract Base Class for QGIS project property hierarchys. More...

#include <qgsprojectproperty.h>

Inheritance diagram for QgsProjectProperty:
Inheritance graph
[legend]

Public Member Functions

 QgsProjectProperty ()
 
virtual ~QgsProjectProperty ()=default
 
virtual void dump (int tabs=0) const =0
 Dumps out the keys and values. More...
 
virtual bool isKey () const =0
 Returns true if the property is a QgsProjectPropertyKey. More...
 
virtual bool isLeaf () const =0
 Returns true if property is a leaf node. More...
 
virtual bool isValue () const =0
 Returns true if the property is a QgsProjectPropertyValue. More...
 
virtual bool readXml (const QDomNode &keyNode)=0
 Restores the property hierarchy from a specified DOM node. More...
 
virtual QVariant value () const =0
 Returns the node's value. More...
 
virtual bool writeXml (const QString &nodeName, QDomElement &element, QDomDocument &document)=0
 Writes the property hierarchy to a specified DOM element. More...
 

Detailed Description

An Abstract Base Class for QGIS project property hierarchys.

Each sub-class is either a QgsProjectPropertyKey or QgsProjectPropertyValue. QgsProjectPropertyKey can contain either QgsProjectPropertyKey or QgsProjectPropertyValues, thus describing an hierarchy. QgsProjectPropertyValues are always graph leaves.

Note
This class is used internally by QgsProject. It's generally recommended that the methods in QgsProject are used to modify project properties rather than using these low-level classes.
Since
QGIS 3.0

Definition at line 50 of file qgsprojectproperty.h.

Constructor & Destructor Documentation

◆ QgsProjectProperty()

QgsProjectProperty::QgsProjectProperty ( )

Definition at line 26 of file qgsprojectproperty.cpp.

◆ ~QgsProjectProperty()

virtual QgsProjectProperty::~QgsProjectProperty ( )
virtualdefault

Member Function Documentation

◆ dump()

virtual void QgsProjectProperty::dump ( int  tabs = 0) const
pure virtual

Dumps out the keys and values.

Parameters
tabsis number of tabs to print; used for pretty-printing hierarchy

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.

◆ isKey()

virtual bool QgsProjectProperty::isKey ( ) const
pure virtual

Returns true if the property is a QgsProjectPropertyKey.

See also
isValue()
isLeaf()

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.

◆ isLeaf()

virtual bool QgsProjectProperty::isLeaf ( ) const
pure virtual

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.

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.

◆ isValue()

virtual bool QgsProjectProperty::isValue ( ) const
pure virtual

Returns true if the property is a QgsProjectPropertyValue.

See also
isKey()
isLeaf()

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.

◆ readXml()

virtual bool QgsProjectProperty::readXml ( const QDomNode &  keyNode)
pure virtual

Restores the property hierarchy from a specified DOM node.

Used for restoring properties from project file

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.

◆ value()

virtual QVariant QgsProjectProperty::value ( ) const
pure virtual

Returns the node's value.

For QgsProjectPropertyValue nodes, this is straightforward – just return the embedded QVariant, _value. For QgsProjectPropertyKey, this means returning the QgsProjectPropertyValue _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.

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.

◆ writeXml()

virtual bool QgsProjectProperty::writeXml ( const QString &  nodeName,
QDomElement &  element,
QDomDocument &  document 
)
pure virtual

Writes the property hierarchy to a specified DOM element.

Used for saving properties to project file.

Parameters
nodeNamethe tag name associated with this element
elementthe parent (or encompassing) property element
documentthe overall project file Dom document

Implemented in QgsProjectPropertyValue, and QgsProjectPropertyKey.


The documentation for this class was generated from the following files: