QGIS API Documentation 3.35.0-Master (f6e073f0eed)
Loading...
Searching...
No Matches
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.
 
static Qgis::LayerType typeFromString (const QString &string, bool &ok)
 Returns the map layer type corresponding a string value.
 
static QString typeToString (Qgis::LayerType type)
 Converts a map layer type to a string value.
 

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: