QGIS API Documentation  3.23.0-Master (eb871beae0)
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, QgsMapLayerType type, const LayerOptions &options, const QString &provider=QString())
 Creates a map layer, given a uri, name, layer type and provider name. More...
 
static QgsMapLayerType typeFromString (const QString &string, bool &ok)
 Returns the map layer type corresponding a string value. More...
 
static QString typeToString (QgsMapLayerType 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 33 of file qgsmaplayerfactory.h.

Member Function Documentation

◆ createLayer()

QgsMapLayer * QgsMapLayerFactory::createLayer ( const QString &  uri,
const QString &  name,
QgsMapLayerType  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 75 of file qgsmaplayerfactory.cpp.

◆ typeFromString()

QgsMapLayerType 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 27 of file qgsmaplayerfactory.cpp.

◆ typeToString()

QString QgsMapLayerFactory::typeToString ( QgsMapLayerType  type)
static

Converts a map layer type to a string value.

See also
typeFromString()

Definition at line 51 of file qgsmaplayerfactory.cpp.


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