Subgroup: Pal

Class: QgsPalLabeling

class qgis.core.QgsPalLabeling

Bases: sip.wrapper

QgsPalLabeling(QgsPalLabeling)

Methods

geometryRequiresPreparation Checks whether a geometry requires preparation before registration with PAL
prepareGeometry Prepares a geometry for registration with PAL.
splitToGraphemes Splits a text string to a list of graphemes, which are the smallest allowable character divisions in the string.
splitToLines Splits a text string to a list of separate lines, using a specified wrap character.
staticWillUseLayer called to find out whether the layer is used for labeling

Signals

Attributes

geometryRequiresPreparation(geometry: QgsGeometry, context: QgsRenderContext, ct: QgsCoordinateTransform, clipGeometry: QgsGeometry = QgsGeometry()) → bool

Checks whether a geometry requires preparation before registration with PAL

Parameters:
  • geometry – geometry to prepare
  • context – render context
  • ct – coordinate transform, or invalid transform if no transformation required
  • clipGeometry – geometry to clip features to, if applicable
Returns:

true if geometry requires preparation

New in version 2.9.

prepareGeometry(geometry: QgsGeometry, context: QgsRenderContext, ct: QgsCoordinateTransform, clipGeometry: QgsGeometry = QgsGeometry()) → QgsGeometry

Prepares a geometry for registration with PAL. Handles reprojection, rotation, clipping, etc.

Parameters:
  • geometry – geometry to prepare
  • context – render context
  • ct – coordinate transform, or invalid transform if no transformation required
  • clipGeometry – geometry to clip features to, if applicable
Returns:

prepared geometry

New in version 2.9.

splitToGraphemes(text: str) → List[str]

Splits a text string to a list of graphemes, which are the smallest allowable character divisions in the string. This accounts for scripts were individual characters are not allowed to be split apart (e.g., Arabic and Indic based scripts)

Parameters:text – string to split
Returns:list of graphemes

New in version 2.10.

splitToLines(text: str, wrapCharacter: str) → List[str]

Splits a text string to a list of separate lines, using a specified wrap character. The text string will be split on either newline characters or the wrap character.

Parameters:
  • text – text string to split
  • wrapCharacter – additional character to wrap on
Returns:

list of text split to lines

New in version 2.9.

staticWillUseLayer(layer: QgsVectorLayer) → bool

called to find out whether the layer is used for labeling

New in version 2.4.