Class: QgsLabelThinningSettings

Contains settings related to how the label engine removes candidate label positions and reduces the number of displayed labels.

Added in version 3.12.

class qgis.core.QgsLabelThinningSettings[source]

Bases: object

limitNumberOfLabelsEnabled(self) bool[source]

Returns True if the number of labels drawn for the layer should be limited.

Return type:

bool

maximumNumberLabels(self) int[source]

Returns the maximum number of labels which should be drawn for this layer. This only has an effect if limitNumberOfLabelsEnabled() is True.

Return type:

int

minimumFeatureSize(self) float[source]

Returns the minimum feature size (in millimeters) for a feature to be labelled.

Return type:

float

setLimitNumberLabelsEnabled(self, enabled: bool)[source]

Sets whether the the number of labels drawn for the layer should be limited.

Parameters:

enabled (bool)

setMaximumNumberLabels(self, number: int)[source]

Sets the maximum number of labels which should be drawn for this layer. This only has an effect if limitNumberOfLabelsEnabled() is True.

Parameters:

number (int)

setMinimumFeatureSize(self, size: float)[source]

Sets the minimum feature size (in millimeters) for a feature to be labelled.

Parameters:

size (float)

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

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

Parameters: