QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
22 #ifndef QGSPROJECTPROPERTY_H
23 #define QGSPROJECTPROPERTY_H
27 #include <QStringList>
28 #include <QCoreApplication>
30 #include "qgis_core.h"
61 virtual void dump(
int tabs = 0 )
const = 0;
92 virtual bool readXml(
const QDomNode &keyNode ) = 0;
104 QDomElement &element,
105 QDomDocument &document ) = 0;
142 bool isKey()
const override {
return false; }
143 bool isValue()
const override {
return true; }
144 QVariant
value()
const override {
return mValue; }
147 bool isLeaf()
const override {
return true; }
149 void dump(
int tabs = 0 )
const override;
150 bool readXml(
const QDomNode &keyNode )
override;
151 bool writeXml(
const QString &nodeName,
152 QDomElement &element,
153 QDomDocument &document )
override;
199 QString
name()
const {
return mName; }
207 void setName(
const QString &name );
213 QVariant
value()
const override;
220 if ( mProperties.contains( keyName ) )
221 delete mProperties.take( keyName );
224 mProperties.insert( keyName, p );
234 delete mProperties.take( keyName );
245 if ( mProperties.contains( name ) )
246 delete mProperties.take( name );
249 mProperties.insert( name, p );
262 return setValue( name(), value );
265 void dump(
int tabs = 0 )
const override;
266 bool readXml(
const QDomNode &keyNode )
override;
267 bool writeXml(
const QString &nodeName, QDomElement &element, QDomDocument &document )
override;
272 int count()
const {
return mProperties.count(); }
277 bool isEmpty()
const {
return mProperties.isEmpty(); }
279 bool isKey()
const override {
return true; }
280 bool isValue()
const override {
return false; }
281 bool isLeaf()
const override;
287 void entryList( QStringList &entries )
const;
293 void subkeyList( QStringList &entries )
const;
309 qDeleteAll( mProperties );
318 return mProperties.
value( propertyName );
327 QHash < QString, QgsProjectProperty * > mProperties;
virtual bool readXml(const QDomNode &keyNode)=0
Restores the property hierarchy from a specified DOM node.
QgsProjectPropertyValue()=default
Constructor for QgsProjectPropertyValue.
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.
QgsProjectPropertyKey * addKey(const QString &keyName)
Adds the specified property key as a sub-key.
QgsProjectProperty * find(const QString &propertyName) const
Attempts to find a property with a matching sub-key name.
QVariant value() const override
Returns the node's value.
virtual void clear()
Resets the property to a default, empty state.
bool isKey() const override
Returns true if the property is a QgsProjectPropertyKey.
void removeKey(const QString &keyName)
Removes the specified key.
virtual ~QgsProjectProperty()=default
virtual QVariant value() const =0
Returns the node's value.
QgsProjectPropertyValue * setValue(const QVariant &value)
Set the value associated with this key.
int count() const
Returns the number of sub-keys contained by this property.
virtual void clearKeys()
Deletes any sub-nodes from the property.
virtual void dump(int tabs=0) const =0
Dumps out the keys and values.
bool isKey() const override
Returns true if the property is a QgsProjectPropertyKey.
bool isLeaf() const override
Returns true if property is a leaf node.
bool isValue() const override
Returns true if the property is a QgsProjectPropertyValue.
virtual bool isKey() const =0
Returns true if the property is a QgsProjectPropertyKey.
bool isValue() const override
Returns true if the property is a QgsProjectPropertyValue.
QgsProjectPropertyValue * setValue(const QString &name, const QVariant &value)
Sets the value associated with this key.
virtual bool writeXml(const QString &nodeName, QDomElement &element, QDomDocument &document)=0
Writes the property hierarchy to a specified DOM element.
QString name() const
The name of the property is used as identifier.
Project property key node.
QgsProjectPropertyValue(const QVariant &value)
Constructor for QgsProjectPropertyValue, initialized to a specified value.
bool isEmpty() const
Returns true if this property contains no sub-keys.
Project property value node, contains a QgsProjectPropertyKey's value.
An Abstract Base Class for QGIS project property hierarchys.