QgsVectorLayerSimpleLabeling class

Basic implementation of the labeling interface.

The configuration is kept in layer's custom properties for backward compatibility.

Base classes

class QgsAbstractVectorLayerLabeling
Abstract base class - its implementations define different approaches to the labeling of a vector layer.

Public static functions

static auto create(const QDomElement& element, const QgsReadWriteContext& context) -> QgsVectorLayerSimpleLabeling*
Create the instance from a DOM element with saved configuration.

Constructors, destructors, conversion operators

QgsVectorLayerSimpleLabeling(const QgsPalLayerSettings& settings) explicit
Constructs simple labeling configuration with given initial settings.

Public functions

auto clone() const -> QgsAbstractVectorLayerLabeling* override
Returns a new copy of the object.
auto provider(QgsVectorLayer* layer) const -> QgsVectorLayerLabelProvider* override
auto requiresAdvancedEffects() const -> bool override
Returns true if drawing labels requires advanced effects like composition modes, which could prevent it being used as an isolated cached image or exported to a vector format.
auto save(QDomDocument& doc, const QgsReadWriteContext& context) const -> QDomElement override
Returns labeling configuration as XML element.
void setSettings(QgsPalLayerSettings* settings, const QString& providerId = QString()) override
Set pal settings (takes ownership).
auto settings(const QString& providerId = QString()) const -> QgsPalLayerSettings override
Gets associated label settings.
void toSld(QDomNode& parent, const QgsStringMap& props) const override
Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings.
auto type() const -> QString override
Unique type string of the labeling configuration implementation.

Function documentation

QgsVectorLayerLabelProvider* QgsVectorLayerSimpleLabeling::provider(QgsVectorLayer* layer) const override

bool QgsVectorLayerSimpleLabeling::requiresAdvancedEffects() const override

Returns true if drawing labels requires advanced effects like composition modes, which could prevent it being used as an isolated cached image or exported to a vector format.

void QgsVectorLayerSimpleLabeling::setSettings(QgsPalLayerSettings* settings, const QString& providerId = QString()) override

Set pal settings (takes ownership).

Parameters
settings Pal layer settings
providerId Unused parameter

QgsPalLayerSettings QgsVectorLayerSimpleLabeling::settings(const QString& providerId = QString()) const override

Gets associated label settings.

In case of multiple sub-providers with different settings, they are identified by their ID (e.g. in case of rule-based labeling, provider ID == rule key)