QgsProjectMetadata class
A structured metadata store for a map layer.
Contents
QgsProjectMetadata handles storage and management of the metadata for a QgsProject. This class is an internal QGIS format with a common metadata structure, which allows for code to access the metadata properties for projects in a uniform way.
The metadata store is designed to be compatible with the Dublin Core metadata specifications, and will be expanded to allow compatibility with ISO specifications in future releases. However, the QGIS internal schema does not represent a superset of all existing metadata schemas and accordingly conversion from specific metadata formats to QgsProjectMetadata may result in a loss of information.
This class is designed to follow the specifications detailed in the schema definition available at resources/qgis-project-metadata.xsd within the QGIS source code.
Metadata can be validated through the use of QgsLayerMetadataValidator subclasses. E.g. validating against the native QGIS metadata schema can be performed using QgsNativeProjectMetadataValidator.
Base classes
- class QgsAbstractMetadataBase
- An abstract base class for metadata stores.
Constructors, destructors, conversion operators
- QgsProjectMetadata() defaulted
- Constructor for QgsProjectMetadata.
Public functions
- auto author() const -> QString
- Returns the project author string.
- auto clone() const -> QgsProjectMetadata* override
- Clones the metadata object.
- auto creationDateTime() const -> QDateTime
- Returns the project's creation date/timestamp.
- auto readMetadataXml(const QDomElement& metadataElement) -> bool override
- Sets state from DOM document.
- void setAuthor(const QString& author)
- Sets the project author string.
- void setCreationDateTime(const QDateTime& creationDateTime)
- Sets the project's creation date/timestamp.
- auto writeMetadataXml(QDomElement& metadataElement, QDomDocument& document) const -> bool override
- Stores state in a DOM node.
Function documentation
QString QgsProjectMetadata:: author() const
Returns the project author string.
QgsProjectMetadata* QgsProjectMetadata:: clone() const override
Clones the metadata object.
QDateTime QgsProjectMetadata:: creationDateTime() const
Returns the project's creation date/timestamp.
bool QgsProjectMetadata:: readMetadataXml(const QDomElement& metadataElement) override
Sets state from DOM document.
| Parameters | |
|---|---|
| metadataElement | The DOM element corresponding to ``resourceMetadata'' tag |
| Returns | true if successful |
Subclasses which override this method should take care to also call the base class method in order to read common metadata properties.
void QgsProjectMetadata:: setAuthor(const QString& author)
Sets the project author string.
void QgsProjectMetadata:: setCreationDateTime(const QDateTime& creationDateTime)
Sets the project's creation date/timestamp.
bool QgsProjectMetadata:: writeMetadataXml(QDomElement& metadataElement,
QDomDocument& document) const override
Stores state in a DOM node.
| Parameters | |
|---|---|
| metadataElement | is a DOM element corresponding to ``resourceMetadata'' tag |
| document | is a the DOM document being written |
| Returns | true if successful |
Subclasses which override this method should take care to also call the base class method in order to write common metadata properties.