Class: QgsTextBufferSettings

class qgis.core.QgsTextBufferSettings

Bases: sip.wrapper

QgsTextBufferSettings(other: QgsTextBufferSettings) Copy constructor.

Parameters

other – source settings

Container for settings relating to a text buffer.

Note

QgsTextBufferSettings objects are implicitly shared.

Methods

blendMode

Returns the blending mode used for drawing the buffer.

color

Returns the color of the buffer.

enabled

Returns whether the buffer is enabled.

fillBufferInterior

Returns whether the interior of the buffer will be filled in.

joinStyle

Returns the buffer join style.

opacity

Returns the buffer opacity.

paintEffect

Returns the current paint effect for the buffer.

readFromLayer

Reads settings from a layer’s custom properties (for QGIS 2.x projects).

readXml

Read settings from a DOM element.

setBlendMode

Sets the blending mode used for drawing the buffer.

setColor

Sets the color for the buffer.

setEnabled

Sets whether the text buffer will be drawn.

setFillBufferInterior

Sets whether the interior of the buffer will be filled in.

setJoinStyle

Sets the join style used for drawing the buffer.

setOpacity

Sets the buffer opacity.

setPaintEffect

Sets the current paint effect for the buffer.

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.

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.

updateDataDefinedProperties

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

writeXml

Write settings into a DOM element.

blendMode(self) → QPainter.CompositionMode

Returns the blending mode used for drawing the buffer.

See also

setBlendMode()

Return type

QPainter.CompositionMode

color(self) → QColor

Returns the color of the buffer.

See also

setColor()

Return type

QColor

enabled(self) → bool

Returns whether the buffer is enabled.

See also

setEnabled()

Return type

bool

fillBufferInterior(self) → bool

Returns whether the interior of the buffer will be filled in. If False, only the stroke of the text will be drawn as the buffer. The effect of this setting is only visible for semi-transparent text.

Return type

bool

joinStyle(self) → Qt.PenJoinStyle

Returns the buffer join style.

See also

setJoinStyle()

Return type

Qt.PenJoinStyle

opacity(self) → float

Returns the buffer 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 buffer.

Return type

QgsPaintEffect

Returns

paint effect

See also

setPaintEffect()

readFromLayer(self, layer: QgsVectorLayer)

Reads settings from a layer’s custom properties (for QGIS 2.x projects).

Parameters

layer (QgsVectorLayer) – source vector layer

readXml(self, elem: QDomElement)

Read settings from a DOM element.

See also

writeXml()

Parameters

elem (QDomElement) –

setBlendMode(self, mode: QPainter.CompositionMode)

Sets the blending mode used for drawing the buffer.

Parameters

mode (QPainter.CompositionMode) – blending mode

See also

blendMode()

setColor(self, color: Union[QColor, Qt.GlobalColor, QGradient])

Sets the color for the buffer.

Parameters

color (Union[QColor) – buffer color

See also

color()

setEnabled(self, enabled: bool)

Sets whether the text buffer will be drawn.

Parameters

enabled (bool) – set to True to draw buffer

See also

enabled()

setFillBufferInterior(self, fill: bool)

Sets whether the interior of the buffer will be filled in.

Parameters

fill (bool) – set to False to drawn only the stroke of the text as the buffer, or True to also shade the area inside the text. The effect of this setting is only visible for semi-transparent text.

setJoinStyle(self, style: Qt.PenJoinStyle)

Sets the join style used for drawing the buffer.

Parameters

style (Qt.PenJoinStyle) – join style

See also

joinStyle()

setOpacity(self, opacity: float)

Sets the buffer 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 buffer.

Parameters

effect (QgsPaintEffect) – paint effect. Ownership is transferred to the buffer 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()

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

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

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

New in version 3.10.

Parameters
writeXml(self, doc: QDomDocument) → QDomElement

Write settings into a DOM element.

See also

readXml()

Parameters

doc (QDomDocument) –

Return type

QDomElement