QgsTextBufferSettings class

Container for settings relating to a text buffer.

Constructors, destructors, conversion operators

QgsTextBufferSettings(const QgsTextBufferSettings& other)
Copy constructor.

Public functions

auto blendMode() const -> QPainter::CompositionMode
Returns the blending mode used for drawing the buffer.
auto color() const -> QColor
Returns the color of the buffer.
auto enabled() const -> bool
Returns whether the buffer is enabled.
auto fillBufferInterior() const -> bool
Returns whether the interior of the buffer will be filled in.
auto joinStyle() const -> Qt::PenJoinStyle
Returns the buffer join style.
auto opacity() const -> double
Returns the buffer opacity.
auto operator=(const QgsTextBufferSettings& other) -> QgsTextBufferSettings&
Copy constructor.
auto paintEffect() const -> QgsPaintEffect*
Returns the current paint effect for the buffer.
void readFromLayer(QgsVectorLayer* layer)
Reads settings from a layer's custom properties (for QGIS 2.x projects).
void readXml(const QDomElement& elem)
Read settings from a DOM element.
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the buffer.
void setColor(const QColor& color)
Sets the color for the buffer.
void setEnabled(bool enabled)
Sets whether the text buffer will be drawn.
void setFillBufferInterior(bool fill)
Sets whether the interior of the buffer will be filled in.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style used for drawing the buffer.
void setOpacity(double opacity)
Sets the buffer opacity.
void setPaintEffect(QgsPaintEffect* effect)
Sets the current paint effect for the buffer.
void setSize(double size)
Sets the size of the buffer.
void setSizeMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale object for the buffer size.
void setSizeUnit(QgsUnitTypes::RenderUnit unit)
Sets the units used for the buffer size.
auto size() const -> double
Returns the size of the buffer.
auto sizeMapUnitScale() const -> QgsMapUnitScale
Returns the map unit scale object for the buffer size.
auto sizeUnit() const -> QgsUnitTypes::RenderUnit
Returns the units for the buffer size.
auto writeXml(QDomDocument& doc) const -> QDomElement
Write settings into a DOM element.

Function documentation

QgsTextBufferSettings::QgsTextBufferSettings(const QgsTextBufferSettings& other)

Copy constructor.

Parameters
other source settings

QPainter::CompositionMode QgsTextBufferSettings::blendMode() const

Returns the blending mode used for drawing the buffer.

QColor QgsTextBufferSettings::color() const

Returns the color of the buffer.

bool QgsTextBufferSettings::enabled() const

Returns whether the buffer is enabled.

bool QgsTextBufferSettings::fillBufferInterior() const

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.

Qt::PenJoinStyle QgsTextBufferSettings::joinStyle() const

Returns the buffer join style.

double QgsTextBufferSettings::opacity() const

Returns the buffer opacity.

The opacity is a double value between 0 (fully transparent) and 1 (totally opaque).

QgsTextBufferSettings& QgsTextBufferSettings::operator=(const QgsTextBufferSettings& other)

Copy constructor.

Parameters
other source QgsTextBufferSettings

QgsPaintEffect* QgsTextBufferSettings::paintEffect() const

Returns the current paint effect for the buffer.

Returns paint effect

void QgsTextBufferSettings::readFromLayer(QgsVectorLayer* layer)

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

Parameters
layer source vector layer

void QgsTextBufferSettings::readXml(const QDomElement& elem)

Read settings from a DOM element.

void QgsTextBufferSettings::setBlendMode(QPainter::CompositionMode mode)

Sets the blending mode used for drawing the buffer.

Parameters
mode blending mode

void QgsTextBufferSettings::setColor(const QColor& color)

Sets the color for the buffer.

Parameters
color buffer color

void QgsTextBufferSettings::setEnabled(bool enabled)

Sets whether the text buffer will be drawn.

Parameters
enabled set to true to draw buffer

void QgsTextBufferSettings::setFillBufferInterior(bool fill)

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

Parameters
fill 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.

void QgsTextBufferSettings::setJoinStyle(Qt::PenJoinStyle style)

Sets the join style used for drawing the buffer.

Parameters
style join style

void QgsTextBufferSettings::setOpacity(double opacity)

Sets the buffer opacity.

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

void QgsTextBufferSettings::setPaintEffect(QgsPaintEffect* effect)

Sets the current paint effect for the buffer.

Parameters
effect paint effect. Ownership is transferred to the buffer settings.

void QgsTextBufferSettings::setSize(double size)

Sets the size of the buffer.

Parameters
size buffer size

The size units are specified using setSizeUnit().

void QgsTextBufferSettings::setSizeMapUnitScale(const QgsMapUnitScale& scale)

Sets the map unit scale object for the buffer size.

Parameters
scale scale for buffer size

This is only used if the buffer size is set to QgsUnitTypes::RenderMapUnit.

void QgsTextBufferSettings::setSizeUnit(QgsUnitTypes::RenderUnit unit)

Sets the units used for the buffer size.

Parameters
unit size unit

double QgsTextBufferSettings::size() const

Returns the size of the buffer.

QgsMapUnitScale QgsTextBufferSettings::sizeMapUnitScale() const

Returns the map unit scale object for the buffer size.

This is only used if the buffer size is set to QgsUnitTypes::RenderMapUnit.

QgsUnitTypes::RenderUnit QgsTextBufferSettings::sizeUnit() const

Returns the units for the buffer size.

QDomElement QgsTextBufferSettings::writeXml(QDomDocument& doc) const

Write settings into a DOM element.