Class: QgsLabelingResults

Stores computed placement from labeling engine.

class qgis.core.QgsLabelingResults[source]

Bases: object

allLabels(self) List[QgsLabelPosition]

Returns a list of all labels generated by the labeling run.

Added in version 3.20.

Return type:

List[QgsLabelPosition]

calloutsWithinRectangle(self, rectangle: QgsRectangle) List[QgsCalloutPosition]

Returns a list of callouts with origins or destinations inside the given rectangle.

The rectangle is specified in map coordinates.

Added in version 3.20.

Parameters:

rectangle (QgsRectangle)

Return type:

List[QgsCalloutPosition]

groupedLabelPositions(self, groupId: int) List[QgsLabelPosition]

Returns a list of all label positions sharing the same group ID (i.e. positions for individual characters in a curved label).

Added in version 3.26.

Parameters:

groupId (int)

Return type:

List[QgsLabelPosition]

labelsAtPosition(self, p: QgsPointXY) List[QgsLabelPosition]

Returns the details of any labels placed at the specified point (in map coordinates).

Parameters:

p (QgsPointXY)

Return type:

List[QgsLabelPosition]

labelsWithinRect(self, r: QgsRectangle) List[QgsLabelPosition]

Returns the details of any labels placed within the specified rectangle (in map coordinates).

Parameters:

r (QgsRectangle)

Return type:

List[QgsLabelPosition]

setMapSettings(self, settings: QgsMapSettings)[source]

Sets the map settings associated with the labeling run.

Added in version 3.4.8.

Parameters:

settings (QgsMapSettings)