Class: QgsTextMaskSettings

class qgis.core.QgsTextMaskSettings

Bases: sip.wrapper

QgsTextMaskSettings(other: QgsTextMaskSettings) Copy constructor.

Parameters

other – source settings

Container for settings relating to a selective masking around a text. A selective masking only makes sense in contexts where the text is rendered over some other map layers, especially for labeling.

Note

QgsTextMaskSettings objects are implicitly shared.

Methods

enabled

Returns whether the mask is enabled.

joinStyle

Returns the buffer join style.

maskedSymbolLayers

Returns a list of references to symbol layers that are masked by this buffer.

opacity

Returns the mask’s opacity.

paintEffect

Returns the current paint effect for the mask.

readXml

Read settings from a DOM element.

referencedFields

Returns all field names referenced by the configuration (e.g.

setEnabled

Returns whether the mask is enabled.

setJoinStyle

Sets the join style used for drawing the buffer.

setMaskedSymbolLayers

Sets the symbol layers that will be masked by this buffer.

setOpacity

Sets the mask’s opacity.

setPaintEffect

Sets the current paint effect for the mask.

setSize

Sets the size of the buffer.

setSizeMapUnitScale

Sets the map unit scale object for the buffer size.

setSizeUnit

Sets the units used for the buffer size.

setType

Sets the type of mask shape.

size

Returns the size of the buffer.

sizeMapUnitScale

Returns the map unit scale object for the buffer size.

sizeUnit

Returns the units for the buffer size.

type

Returns the type of mask shape.

updateDataDefinedProperties

Updates the format by evaluating current values of data defined properties.

writeXml

Write settings into a DOM element.

Attributes

MaskBuffer

MaskBuffer = 0
class MaskType

Bases: int

enabled(self)bool

Returns whether the mask is enabled.

Return type

bool

joinStyle(self)Qt.PenJoinStyle

Returns the buffer join style.

See also

setJoinStyle()

Return type

Qt.PenJoinStyle

maskedSymbolLayers(self)List[QgsSymbolLayerReference]

Returns a list of references to symbol layers that are masked by this buffer.

Return type

List[QgsSymbolLayerReference]

Returns

a list of references to masked symbol layers

opacity(self)float

Returns the mask’s opacity. The opacity is a double value between 0 (fully transparent) and 1 (totally opaque).

See also

setOpacity()

Return type

float

paintEffect(self)QgsPaintEffect

Returns the current paint effect for the mask.

Return type

QgsPaintEffect

Returns

paint effect

See also

setPaintEffect()

readXml(self, elem: QDomElement)

Read settings from a DOM element.

See also

writeXml()

Parameters

elem (QDomElement) –

referencedFields(self, context: QgsRenderContext)Set[str]

Returns all field names referenced by the configuration (e.g. from data defined properties).

New in version 3.14.

Parameters

context (QgsRenderContext) –

Return type

Set[str]

setEnabled(self, bool)

Returns whether the mask is enabled.

setJoinStyle(self, style: Qt.PenJoinStyle)

Sets the join style used for drawing the buffer.

Parameters

style (Qt.PenJoinStyle) – join style

See also

joinStyle()

setMaskedSymbolLayers(self, maskedLayers: Iterable[QgsSymbolLayerReference])

Sets the symbol layers that will be masked by this buffer.

Parameters

maskedLayers (Iterable[QgsSymbolLayerReference]) – list of references to symbol layers

setOpacity(self, opacity: float)

Sets the mask’s opacity.

Parameters

opacity (float) – opacity as a double value between 0 (fully transparent) and 1 (totally opaque)

See also

opacity()

setPaintEffect(self, effect: QgsPaintEffect)

Sets the current paint effect for the mask.

Parameters

effect (QgsPaintEffect) – paint effect. Ownership is transferred to the mask settings.

See also

paintEffect()

setSize(self, size: float)

Sets the size of the buffer. The size units are specified using setSizeUnit().

Parameters

size (float) – buffer size

See also

size()

See also

setSizeUnit()

setSizeMapUnitScale(self, scale: QgsMapUnitScale)

Sets the map unit scale object for the buffer size. This is only used if the buffer size is set to QgsUnitTypes.RenderMapUnit.

Parameters

scale (QgsMapUnitScale) – scale for buffer size

See also

setSizeUnit()

setSizeUnit(self, unit: QgsUnitTypes.RenderUnit)

Sets the units used for the buffer size.

Parameters

unit (QgsUnitTypes.RenderUnit) – size unit

See also

setSize()

See also

sizeUnit()

setType(self, type: QgsTextMaskSettings.MaskType)

Sets the type of mask shape.

Parameters

type (QgsTextMaskSettings.MaskType) – shape type

See also

type()

size(self)float

Returns the size of the buffer.

See also

sizeUnit()

See also

setSize()

Return type

float

sizeMapUnitScale(self)QgsMapUnitScale

Returns the map unit scale object for the buffer size. This is only used if the buffer size is set to QgsUnitTypes.RenderMapUnit.

See also

sizeUnit()

Return type

QgsMapUnitScale

sizeUnit(self)QgsUnitTypes.RenderUnit

Returns the units for the buffer size.

See also

size()

See also

setSizeUnit()

Return type

QgsUnitTypes.RenderUnit

type(self)QgsTextMaskSettings.MaskType

Returns the type of mask shape.

See also

setType()

Return type

QgsTextMaskSettings.MaskType

updateDataDefinedProperties(self, context: QgsRenderContext, properties: QgsPropertyCollection)

Updates the format by evaluating current values of data defined properties.

Parameters
writeXml(self, doc: QDomDocument)QDomElement

Write settings into a DOM element.

See also

readXml()

Parameters

doc (QDomDocument) –

Return type

QDomElement