QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Classes | Static Public Member Functions | List of all members
QgsLayerDefinition Class Reference

The QgsLayerDefinition class holds generic methods for loading/exporting QLR files. More...

#include <qgslayerdefinition.h>

Classes

class  DependencySorter
 Class used to work with layer dependencies stored in a XML project or layer definition file. More...
 

Static Public Member Functions

static bool exportLayerDefinition (QString path, const QList< QgsLayerTreeNode * > &selectedTreeNodes, QString &errorMessage)
 Export the selected layer tree nodes to a QLR file. More...
 
static bool exportLayerDefinition (QDomDocument doc, const QList< QgsLayerTreeNode * > &selectedTreeNodes, QString &errorMessage, const QgsReadWriteContext &context)
 Export the selected layer tree nodes to a QLR-XML document. More...
 
static QDomDocument exportLayerDefinitionLayers (const QList< QgsMapLayer * > &layers, const QgsReadWriteContext &context)
 Returns the given layer as a layer definition document Layer definitions store the data source as well as styling and custom properties. More...
 
static bool loadLayerDefinition (const QString &path, QgsProject *project, QgsLayerTreeGroup *rootGroup, QString &errorMessage)
 Loads the QLR at path into QGIS. New layers are added to given project into layer tree specified by rootGroup. More...
 
static bool loadLayerDefinition (QDomDocument doc, QgsProject *project, QgsLayerTreeGroup *rootGroup, QString &errorMessage, QgsReadWriteContext &context)
 Loads the QLR from the XML document. New layers are added to given project into layer tree specified by rootGroup. More...
 
static QList< QgsMapLayer * > loadLayerDefinitionLayers (QDomDocument &document, QgsReadWriteContext &context)
 Creates new layers from a layer definition document. More...
 
static QList< QgsMapLayer * > loadLayerDefinitionLayers (const QString &qlrfile)
 Creates new layers from a layer definition file (.QLR) This is a low-level routine that does not resolve layer ID conflicts, dependencies and joins. More...
 

Detailed Description

The QgsLayerDefinition class holds generic methods for loading/exporting QLR files.

QLR files are an export of the layer xml including the style and datasource location. There is no link to the QLR file once loaded. Consider the QLR file a mini project file for layers and styles. QLR files also store the layer tree info for the exported layers, including group information.

Definition at line 42 of file qgslayerdefinition.h.

Member Function Documentation

bool QgsLayerDefinition::exportLayerDefinition ( QString  path,
const QList< QgsLayerTreeNode * > &  selectedTreeNodes,
QString &  errorMessage 
)
static

Export the selected layer tree nodes to a QLR file.

Definition at line 174 of file qgslayerdefinition.cpp.

bool QgsLayerDefinition::exportLayerDefinition ( QDomDocument  doc,
const QList< QgsLayerTreeNode * > &  selectedTreeNodes,
QString &  errorMessage,
const QgsReadWriteContext context 
)
static

Export the selected layer tree nodes to a QLR-XML document.

Definition at line 199 of file qgslayerdefinition.cpp.

QDomDocument QgsLayerDefinition::exportLayerDefinitionLayers ( const QList< QgsMapLayer * > &  layers,
const QgsReadWriteContext context 
)
static

Returns the given layer as a layer definition document Layer definitions store the data source as well as styling and custom properties.

Layer definitions can be used to load a layer and styling all from a single file.

This is a low-level routine that does not write layer tree.

See also
exportLayerDefinition()

Definition at line 230 of file qgslayerdefinition.cpp.

bool QgsLayerDefinition::loadLayerDefinition ( const QString &  path,
QgsProject project,
QgsLayerTreeGroup rootGroup,
QString &  errorMessage 
)
static

Loads the QLR at path into QGIS. New layers are added to given project into layer tree specified by rootGroup.

Definition at line 32 of file qgslayerdefinition.cpp.

bool QgsLayerDefinition::loadLayerDefinition ( QDomDocument  doc,
QgsProject project,
QgsLayerTreeGroup rootGroup,
QString &  errorMessage,
QgsReadWriteContext context 
)
static

Loads the QLR from the XML document. New layers are added to given project into layer tree specified by rootGroup.

Definition at line 59 of file qgslayerdefinition.cpp.

QList< QgsMapLayer * > QgsLayerDefinition::loadLayerDefinitionLayers ( QDomDocument &  document,
QgsReadWriteContext context 
)
static

Creates new layers from a layer definition document.

This is a low-level routine that does not resolve layer ID conflicts, dependencies and joins

See also
loadLayerDefinition()

Definition at line 246 of file qgslayerdefinition.cpp.

QList< QgsMapLayer * > QgsLayerDefinition::loadLayerDefinitionLayers ( const QString &  qlrfile)
static

Creates new layers from a layer definition file (.QLR) This is a low-level routine that does not resolve layer ID conflicts, dependencies and joins.

See also
loadLayerDefinition()

Definition at line 284 of file qgslayerdefinition.cpp.


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