QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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.
 
virtual bool isKey () const =0
 Returns true if the property is a QgsProjectPropertyKey.
 
virtual bool isLeaf () const =0
 Returns true if property is a leaf node.
 
virtual bool isValue () const =0
 Returns true if the property is a QgsProjectPropertyValue.
 
virtual bool readXml (const QDomNode &keyNode)=0
 Restores the property hierarchy from a specified DOM node.
 
virtual QVariant value () const =0
 Returns the node's value.
 
virtual bool writeXml (const QString &nodeName, QDomElement &element, QDomDocument &document)=0
 Writes the property hierarchy to a specified DOM element.
 

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.

Definition at line 49 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: