Class: QgsLabelPlacementSettings

Contains general settings related to how labels are placed.

Added in version 3.26.

List of all members, including inherited members

Methods

allowDegradedPlacement

Returns True if labels can be placed in inferior fallback positions if they cannot otherwise be placed.

multiPartBehavior

Returns the multipart labeling behavior.

overlapHandling

Returns the technique used to handle overlapping labels.

prioritization

Returns the label prioritization technique.

setAllowDegradedPlacement

Sets whether labels can be placed in inferior fallback positions if they cannot otherwise be placed.

setMultiPartBehavior

Sets the multipart labeling behavior.

setOverlapHandling

Sets the technique used to handle overlapping labels.

setPrioritization

Sets the technique used to prioritize labels.

setWhitespaceCollisionHandling

Sets the whitespace collision handling.

updateDataDefinedProperties

Updates the placement settings to respect any data defined properties set within the specified properties collection.

whitespaceCollisionHandling

Returns the whitespace collision handling.

class qgis.core.QgsLabelPlacementSettings[source]

Bases: object

allowDegradedPlacement(self) bool[source]

Returns True if labels can be placed in inferior fallback positions if they cannot otherwise be placed.

For instance, this will permit a curved line label to fallback to a horizontal label at the end of the line if the label cannot otherwise be placed on the line in a curved manner.

Return type:

bool

multiPartBehavior(self) Qgis.MultiPartLabelingBehavior[source]

Returns the multipart labeling behavior.

Added in version 4.0.

Return type:

Qgis.MultiPartLabelingBehavior

overlapHandling(self) Qgis.LabelOverlapHandling[source]

Returns the technique used to handle overlapping labels.

Return type:

Qgis.LabelOverlapHandling

prioritization(self) Qgis.LabelPrioritization[source]

Returns the label prioritization technique.

Added in version 3.38.

Return type:

Qgis.LabelPrioritization

setAllowDegradedPlacement(self, allow: bool)[source]

Sets whether labels can be placed in inferior fallback positions if they cannot otherwise be placed.

For instance, this will permit a curved line label to fallback to a horizontal label at the end of the line if the label cannot otherwise be placed on the line in a curved manner.

Parameters:

allow (bool)

setMultiPartBehavior(self, behavior: Qgis.MultiPartLabelingBehavior)[source]

Sets the multipart labeling behavior.

Added in version 4.0.

Parameters:

behavior (Qgis.MultiPartLabelingBehavior)

setOverlapHandling(self, handling: Qgis.LabelOverlapHandling)[source]

Sets the technique used to handle overlapping labels.

Parameters:

handling (Qgis.LabelOverlapHandling)

setPrioritization(self, prioritization: Qgis.LabelPrioritization)[source]

Sets the technique used to prioritize labels.

See also

prioritization()

Added in version 3.38.

Parameters:

prioritization (Qgis.LabelPrioritization)

setWhitespaceCollisionHandling(self, handling: Qgis.LabelWhitespaceCollisionHandling)[source]

Sets the whitespace collision handling.

Added in version 4.0.

Parameters:

handling (Qgis.LabelWhitespaceCollisionHandling)

updateDataDefinedProperties(self, properties: QgsPropertyCollection, context: QgsExpressionContext)[source]

Updates the placement settings to respect any data defined properties set within the specified properties collection.

Parameters:
whitespaceCollisionHandling(self) Qgis.LabelWhitespaceCollisionHandling[source]

Returns the whitespace collision handling.

Added in version 4.0.

Return type:

Qgis.LabelWhitespaceCollisionHandling