QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
QgsProjectUtils Class Reference

Contains utility functions for working with QGIS projects. More...

#include <qgsprojectutils.h>

Static Public Member Functions

static bool layerIsContainedInGroupLayer (QgsProject *project, QgsMapLayer *layer)
 Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.
 
static QList< QgsMapLayer * > layersMatchingPath (const QgsProject *project, const QString &path)
 Returns a list of all layers in the specified project which match the given path.
 
static bool updateLayerPath (QgsProject *project, const QString &oldPath, const QString &newPath)
 Updates a project, replacing the data source for all layers which match the given oldPath with sources which point to newPath.
 

Detailed Description

Contains utility functions for working with QGIS projects.

Since
QGIS 3.22

Definition at line 34 of file qgsprojectutils.h.

Member Function Documentation

◆ layerIsContainedInGroupLayer()

bool QgsProjectUtils::layerIsContainedInGroupLayer ( QgsProject project,
QgsMapLayer layer 
)
static

Returns true if the specified layer is a child layer from any QgsGroupLayer in the given project.

Since
QGIS 3.24

Definition at line 58 of file qgsprojectutils.cpp.

◆ layersMatchingPath()

QList< QgsMapLayer * > QgsProjectUtils::layersMatchingPath ( const QgsProject project,
const QString &  path 
)
static

Returns a list of all layers in the specified project which match the given path.

This method can be used to retrieve a list of layers in a project associated with a file path.

Definition at line 24 of file qgsprojectutils.cpp.

◆ updateLayerPath()

bool QgsProjectUtils::updateLayerPath ( QgsProject project,
const QString &  oldPath,
const QString &  newPath 
)
static

Updates a project, replacing the data source for all layers which match the given oldPath with sources which point to newPath.

Returns true if any layers were updated as a result.

Definition at line 41 of file qgsprojectutils.cpp.


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