QGIS API Documentation  3.37.0-Master (a5b4d9743e8)
Classes | Static Public Member Functions | List of all members
QgsMapLayerFactory Class Reference

Contains utility functions for creating map layers. More...

#include <qgsmaplayerfactory.h>

Classes

struct  LayerOptions
 Setting options for loading layers. More...
 

Static Public Member Functions

static QgsMapLayercreateLayer (const QString &uri, const QString &name, Qgis::LayerType type, const LayerOptions &options, const QString &provider=QString())
 Creates a map layer, given a uri, name, layer type and provider name. More...
 
static Qgis::LayerType typeFromString (const QString &string, bool &ok)
 Returns the map layer type corresponding a string value. More...
 
static QString typeToString (Qgis::LayerType type)
 Converts a map layer type to a string value. More...
 

Detailed Description

Contains utility functions for creating map layers.

Since
QGIS 3.18.1

Definition at line 36 of file qgsmaplayerfactory.h.

Member Function Documentation

◆ createLayer()

QgsMapLayer * QgsMapLayerFactory::createLayer ( const QString &  uri,
const QString &  name,
Qgis::LayerType  type,
const LayerOptions options,
const QString &  provider = QString() 
)
static

Creates a map layer, given a uri, name, layer type and provider name.

Caller takes ownership of the returned layer.

Since
QGIS 3.22

Definition at line 80 of file qgsmaplayerfactory.cpp.

◆ typeFromString()

Qgis::LayerType QgsMapLayerFactory::typeFromString ( const QString &  string,
bool &  ok 
)
static

Returns the map layer type corresponding a string value.

Parameters
stringstring to convert to map layer type
okwill be set to true if string was successfully converted to a map layer type
Returns
converted map layer type
See also
typeToString()

Definition at line 28 of file qgsmaplayerfactory.cpp.

◆ typeToString()

QString QgsMapLayerFactory::typeToString ( Qgis::LayerType  type)
static

Converts a map layer type to a string value.

See also
typeFromString()

Definition at line 54 of file qgsmaplayerfactory.cpp.


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