QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | List of all members
QgsProperty Class Referenceabstract

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

#include <qgsprojectproperty.h>

Inheritance diagram for QgsProperty:
Inheritance graph
[legend]

Public Member Functions

 QgsProperty ()
 
virtual ~QgsProperty ()
 
virtual void dump (int tabs=0) const =0
 Dumps out the keys and values. More...
 
virtual bool isKey () const =0
 Returns true if is a QgsPropertyKey. More...
 
virtual bool isLeaf () const =0
 Returns true if a leaf node. More...
 
virtual bool isValue () const =0
 Returns true if is a QgsPropertyValue. More...
 
virtual bool readXML (QDomNode &keyNode)=0
 restores property hierarchy to given Dom node More...
 
virtual QVariant value () const =0
 Return the node's value. More...
 
virtual bool writeXML (const QString &nodeName, QDomElement &element, QDomDocument &document)=0
 adds property hierarchy to given Dom element More...
 

Detailed Description

An Abstract Base Class for QGIS project property hierarchies.

Each sub-class is either a QgsPropertyKey or QgsPropertyValue. QgsPropertyKeys can contain either QgsPropertyKeys or QgsPropertyValues, thus describing an hierarchy. QgsPropertyValues are always graph leaves.

Note

This is really a hidden QgsProject implementation class. It was getting too large and unwieldy, so it's broken out here into separate files.

Definition at line 47 of file qgsprojectproperty.h.

Constructor & Destructor Documentation

◆ QgsProperty()

QgsProperty::QgsProperty ( )

Definition at line 24 of file qgsprojectproperty.cpp.

◆ ~QgsProperty()

QgsProperty::~QgsProperty ( )
virtual

Definition at line 28 of file qgsprojectproperty.cpp.

Member Function Documentation

◆ dump()

virtual void QgsProperty::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 QgsPropertyKey, and QgsPropertyValue.

◆ isKey()

virtual bool QgsProperty::isKey ( ) const
pure virtual

Returns true if is a QgsPropertyKey.

Implemented in QgsPropertyKey, and QgsPropertyValue.

◆ isLeaf()

virtual bool QgsProperty::isLeaf ( ) const
pure virtual

Returns true if a leaf node.

A leaf node is a key node that has either no value or 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 QgsPropertyKey, and QgsPropertyValue.

◆ isValue()

virtual bool QgsProperty::isValue ( ) const
pure virtual

Returns true if is a QgsPropertyValue.

Implemented in QgsPropertyKey, and QgsPropertyValue.

◆ readXML()

virtual bool QgsProperty::readXML ( QDomNode keyNode)
pure virtual

restores property hierarchy to given Dom node

Used for restoring properties from project file

Implemented in QgsPropertyKey, and QgsPropertyValue.

◆ value()

virtual QVariant QgsProperty::value ( ) const
pure virtual

Return the node's value.

For QgsPropertyValue nodes, this is straightforward – just return the embedded QVariant, _value. For QgsPropertyKey, this means returning the QgsPropertyValue _value that is keyed by its name, if it exists; i.e., QgsPropertyKey "foo" will return the property value mapped to its name, "foo", in its QHash of QProperties.

Implemented in QgsPropertyKey, and QgsPropertyValue.

◆ writeXML()

virtual bool QgsProperty::writeXML ( const QString nodeName,
QDomElement element,
QDomDocument document 
)
pure virtual

adds property hierarchy to given 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 QgsPropertyKey, and QgsPropertyValue.


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