Class: QgsLabelPosition

Represents the calculated placement of a map label.

class qgis.core.QgsLabelPosition[source]

Bases: object

__init__(id: int, r: float, corners: Iterable[QgsPointXY], rect: QgsRectangle, w: float, h: float, layer: str | None, labeltext: str | None, labelfont: QFont, upside_down: bool, diagram: bool = False, pinned: bool = False, providerId: str | None = '', labelGeometry: QgsGeometry = QgsGeometry(), isUnplaced: bool = False)

Constructor for QgsLabelPosition.

Parameters:
  • id (int) – associated feature ID

  • r (float) – label rotation in degrees clockwise

  • corners (Iterable[QgsPointXY]) – corner points of label bounding box, in map units

  • rect (QgsRectangle) – label bounding box, in map units

  • w (float) – width of label, in map units

  • h (float) – height of label, in map units

  • layer (Optional[str]) – ID of associated map layer

  • labeltext (Optional[str]) – text rendered for label

  • labelfont (QFont) – font used to render label

  • upside_down (bool) – True if label is upside down

  • diagram (bool = False) – True if label is a diagram

  • pinned (bool = False) – True if label has pinned placement

  • providerId (Optional[str] = '') – ID of associated label provider

  • labelGeometry (QgsGeometry = QgsGeometry()) – polygon geometry of label boundary

  • isUnplaced (bool = False) – set to True if label was unplaced (e.g. due to collisions with other labels)

__init__()
__init__(a0: QgsLabelPosition)
Parameters:

a0 (QgsLabelPosition)

cornerPoints
featureId: QgsFeatureId
groupedLabelId: int
height: float
isDiagram: bool
isPinned: bool
isUnplaced: bool
labelFont: QFont
labelGeometry: QgsGeometry
labelRect
labelText: str
layerID: str
providerID: str
rotation: float
upsideDown: bool
width: float