Class: QgsLabelingEngineSettings

class qgis.core.QgsLabelingEngineSettings

Bases: sip.wrapper

Stores global configuration for labeling engine

New in version 3.0:

Enums

Flag

alias of LabelingFlag

PlacementEngineVersion

alias of LabelPlacementEngineVersion

Methods

clear

Returns the configuration to the defaults

defaultTextRenderFormat

Returns the default text rendering format for the labels.

flags

Gets flags of the labeling engine

maximumLineCandidatesPerCm

Returns the maximum number of line label candidate positions per centimeter.

maximumPolygonCandidatesPerCmSquared

Returns the maximum number of polygon label candidate positions per centimeter squared.

numCandidatePositions

Gets number of candidate positions that will be generated for each label feature.

placementVersion

Returns the placement engine version, which dictates how the label placement problem is solved.

readSettingsFromProject

Read configuration of the labeling engine from a project

searchMethod

Which search method to use for removal collisions between labels

setDefaultTextRenderFormat

Sets the default text rendering format for the labels.

setFlag

Sets whether a particual flag is enabled

setFlags

Sets flags of the labeling engine

setMaximumLineCandidatesPerCm

Sets the maximum number of line label candidates per centimeter.

setMaximumPolygonCandidatesPerCmSquared

Sets the maximum number of polygon label candidates per centimeter squared.

setNumCandidatePositions

Sets the number of candidate positions that will be generated for each label feature.

setPlacementVersion

Sets the placement engine version, which dictates how the label placement problem is solved.

setSearchMethod

Used to set which search method to use for removal collisions between labels

setUnplacedLabelColor

Sets the color to use when rendering unplaced labels.

testFlag

Test whether a particular flag is enabled

unplacedLabelColor

Returns the color to use when rendering unplaced labels.

writeSettingsToProject

Write configuration of the labeling engine to a project

Attributes

Chain

Falp

Popmusic_Chain

Popmusic_Tabu

Popmusic_Tabu_Chain

Chain = 0
Falp = 4
Flag

alias of LabelingFlag

Flags

alias of LabelingFlags

PlacementEngineVersion

alias of LabelPlacementEngineVersion

Popmusic_Chain = 2
Popmusic_Tabu = 1
Popmusic_Tabu_Chain = 3
class Search

Bases: int

clear(self)

Returns the configuration to the defaults

defaultTextRenderFormat(self) Qgis.TextRenderFormat

Returns the default text rendering format for the labels.

New in version 3.4.3.

Return type

Qgis.TextRenderFormat

flags(self) Qgis.LabelingFlags

Gets flags of the labeling engine

Return type

Qgis.LabelingFlags

maximumLineCandidatesPerCm(self) float

Returns the maximum number of line label candidate positions per centimeter.

New in version 3.12.

Return type

float

maximumPolygonCandidatesPerCmSquared(self) float

Returns the maximum number of polygon label candidate positions per centimeter squared.

New in version 3.12.

Return type

float

numCandidatePositions(self) Tuple[int, int, int]

Gets number of candidate positions that will be generated for each label feature.

Deprecated since version QGIS: 3.12 use maximumPolygonCandidatesPerCmSquared() and maximumLineCandidatesPerCm() instead.

Return type

Tuple[int, int, int]

placementVersion(self) Qgis.LabelPlacementEngineVersion

Returns the placement engine version, which dictates how the label placement problem is solved.

New in version 3.10.2.

Return type

Qgis.LabelPlacementEngineVersion

readSettingsFromProject(self, project: QgsProject)

Read configuration of the labeling engine from a project

Parameters

project (QgsProject) –

searchMethod(self) QgsLabelingEngineSettings.Search

Which search method to use for removal collisions between labels

Deprecated since version QGIS: 3.10 - Chain is always used.

Return type

QgsLabelingEngineSettings.Search

setDefaultTextRenderFormat(self, format: Qgis.TextRenderFormat)

Sets the default text rendering format for the labels.

New in version 3.4.3.

Parameters

format (Qgis.TextRenderFormat) –

setFlag(self, f: Qgis.LabelingFlag, enabled: bool = True)

Sets whether a particual flag is enabled

Parameters
setFlags(self, flags: Union[Qgis.LabelingFlags, Qgis.LabelingFlag])

Sets flags of the labeling engine

Parameters

flags (Union[Qgis.LabelingFlags) –

setMaximumLineCandidatesPerCm(self, candidates: float)

Sets the maximum number of line label candidates per centimeter.

New in version 3.12.

Parameters

candidates (float) –

setMaximumPolygonCandidatesPerCmSquared(self, candidates: float)

Sets the maximum number of polygon label candidates per centimeter squared.

New in version 3.12.

Parameters

candidates (float) –

setNumCandidatePositions(self, candPoint: int, candLine: int, candPolygon: int)

Sets the number of candidate positions that will be generated for each label feature.

Deprecated since version QGIS: 3.12 use setMaximumPolygonCandidatesPerCmSquared() and setMaximumLineCandidatesPerCm() instead.

Parameters
  • candPoint (int) –

  • candLine (int) –

  • candPolygon (int) –

setPlacementVersion(self, version: Qgis.LabelPlacementEngineVersion)

Sets the placement engine version, which dictates how the label placement problem is solved.

New in version 3.10.2.

Parameters

version (Qgis.LabelPlacementEngineVersion) –

setSearchMethod(self, s: QgsLabelingEngineSettings.Search)

Used to set which search method to use for removal collisions between labels

Deprecated since version QGIS: 3.10 - Chain is always used.

Parameters

s (QgsLabelingEngineSettings.Search) –

setUnplacedLabelColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color to use when rendering unplaced labels.

New in version 3.10.

Parameters

color (Union[QColor) –

testFlag(self, f: Qgis.LabelingFlag) bool

Test whether a particular flag is enabled

Parameters

f (Qgis.LabelingFlag) –

Return type

bool

unplacedLabelColor(self) QColor

Returns the color to use when rendering unplaced labels.

New in version 3.10.

Return type

QColor

writeSettingsToProject(self, project: QgsProject)

Write configuration of the labeling engine to a project

Parameters

project (QgsProject) –