QGIS API Documentation
3.24.2-Tisler (13c1a02865)
|
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 (const QString &path, const QList< QgsLayerTreeNode * > &selectedTreeNodes, Qgis::FilePathType pathType, QString &errorMessage) |
Exports the selected layer tree nodes to a QLR file. More... | |
static bool | exportLayerDefinition (const QString &path, const QList< QgsLayerTreeNode * > &selectedTreeNodes, QString &errorMessage) |
Exports the selected layer tree nodes to a QLR file. More... | |
static bool | exportLayerDefinition (QDomDocument doc, const QList< QgsLayerTreeNode * > &selectedTreeNodes, QString &errorMessage, const QgsReadWriteContext &context) |
Exports 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 (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... | |
static QList< QgsMapLayer * > | loadLayerDefinitionLayers (QDomDocument &document, QgsReadWriteContext &context) |
Creates new layers from a layer definition document. More... | |
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 43 of file qgslayerdefinition.h.
|
static |
Exports the selected layer tree nodes to a QLR file.
path | file path for exported QLR file |
selectedTreeNodes | layer tree nodes to include in the QLR file |
pathType | specifies whether absolute or relative file paths should be used. |
errorMessage | will be set to any error messages generated during the export |
true
if the export was successfulDefinition at line 207 of file qgslayerdefinition.cpp.
|
static |
Exports the selected layer tree nodes to a QLR file.
This method uses the QgsProject::instance()'s file path setting to determine whether absolute or relative paths are written. Use the variant with an explicit argument for file path type for control over this setting.
path | file path for exported QLR file |
selectedTreeNodes | layer tree nodes to include in the QLR file |
errorMessage | will be set to any error messages generated during the export |
true
if the export was successful Definition at line 202 of file qgslayerdefinition.cpp.
|
static |
Exports the selected layer tree nodes to a QLR XML document.
Definition at line 238 of file qgslayerdefinition.cpp.
|
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.
Definition at line 271 of file qgslayerdefinition.cpp.
|
static |
Loads the QLR at path into QGIS. New layers are added to given project into layer tree specified by rootGroup.
Definition at line 40 of file qgslayerdefinition.cpp.
|
static |
Loads the QLR from the XML document. New layers are added to given project into layer tree specified by rootGroup.
Definition at line 67 of file qgslayerdefinition.cpp.
|
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.
Definition at line 367 of file qgslayerdefinition.cpp.
|
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
Definition at line 288 of file qgslayerdefinition.cpp.