QgsTextShadowSettings class

Container for settings relating to a text shadow.

Public types

enum ShadowPlacement { ShadowLowest = 0, ShadowText, ShadowBuffer, ShadowShape }
Placement positions for text shadow.

Constructors, destructors, conversion operators

QgsTextShadowSettings(const QgsTextShadowSettings& other)
Copy constructor.

Public functions

auto blendMode() const -> QPainter::CompositionMode
Returns the blending mode used for drawing the drop shadow.
auto blurAlphaOnly() const -> bool
Returns whether only the alpha channel for the shadow will be blurred.
auto blurRadius() const -> double
Returns the blur radius for the shadow.
auto blurRadiusMapUnitScale() const -> QgsMapUnitScale
Returns the map unit scale object for the shadow blur radius.
auto blurRadiusUnit() const -> QgsUnitTypes::RenderUnit
Returns the units used for the shadow's blur radius.
auto color() const -> QColor
Returns the color of the drop shadow.
auto enabled() const -> bool
Returns whether the shadow is enabled.
auto offsetAngle() const -> int
Returns the angle for offsetting the position of the shadow from the text.
auto offsetDistance() const -> double
Returns the distance for offsetting the position of the shadow from the text.
auto offsetGlobal() const -> bool
Returns true if the global shadow offset will be used.
auto offsetMapUnitScale() const -> QgsMapUnitScale
Returns the map unit scale object for the shadow offset distance.
auto offsetUnit() const -> QgsUnitTypes::RenderUnit
Returns the units used for the shadow's offset.
auto opacity() const -> double
Returns the shadow's opacity.
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.
auto scale() const -> int
Returns the scaling used for the drop shadow (in percentage of original size).
void setBlendMode(QPainter::CompositionMode mode)
Sets the blending mode used for drawing the drop shadow.
void setBlurAlphaOnly(bool alphaOnly)
Sets whether only the alpha channel for the shadow should be blurred.
void setBlurRadius(double blurRadius)
Sets the blur radius for the shadow.
void setBlurRadiusMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale object for the shadow blur radius.
void setBlurRadiusUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shadow's blur radius.
void setColor(const QColor& color)
Sets the color for the drop shadow.
void setEnabled(bool enabled)
Sets whether the text shadow will be drawn.
void setOffsetAngle(int angle)
Sets the angle for offsetting the position of the shadow from the text.
void setOffsetDistance(double distance)
Sets the distance for offsetting the position of the shadow from the text.
void setOffsetGlobal(bool global)
Sets whether the global shadow offset should be used.
void setOffsetMapUnitScale(const QgsMapUnitScale& scale)
Sets the map unit scale object for the shadow offset distance.
void setOffsetUnit(QgsUnitTypes::RenderUnit units)
Sets the units used for the shadow's offset.
void setOpacity(double opacity)
Sets the shadow's opacity.
void setScale(int scale)
Sets the scaling used for the drop shadow (in percentage of original size).
void setShadowPlacement(QgsTextShadowSettings::ShadowPlacement placement)
Sets the placement for the drop shadow.
auto shadowPlacement() const -> QgsTextShadowSettings::ShadowPlacement
Returns the placement for the drop shadow.
auto writeXml(QDomDocument& doc) const -> QDomElement
Write settings into a DOM element.

Enum documentation

enum QgsTextShadowSettings::ShadowPlacement

Placement positions for text shadow.

Enumerators
ShadowLowest

Draw shadow below all text components.

ShadowText

Draw shadow under text.

ShadowBuffer

Draw shadow under buffer.

ShadowShape

Draw shadow under background shape.

Function documentation

QgsTextShadowSettings::QgsTextShadowSettings(const QgsTextShadowSettings& other)

Copy constructor.

Parameters
other source QgsTextShadowSettings

QPainter::CompositionMode QgsTextShadowSettings::blendMode() const

Returns the blending mode used for drawing the drop shadow.

bool QgsTextShadowSettings::blurAlphaOnly() const

Returns whether only the alpha channel for the shadow will be blurred.

double QgsTextShadowSettings::blurRadius() const

Returns the blur radius for the shadow.

Radius units are retrieved via blurRadiusUnits().

QgsMapUnitScale QgsTextShadowSettings::blurRadiusMapUnitScale() const

Returns the map unit scale object for the shadow blur radius.

This is only used if the blurRadiusUnit() is set to QgsUnitTypes::RenderMapUnit.

QgsUnitTypes::RenderUnit QgsTextShadowSettings::blurRadiusUnit() const

Returns the units used for the shadow's blur radius.

QColor QgsTextShadowSettings::color() const

Returns the color of the drop shadow.

bool QgsTextShadowSettings::enabled() const

Returns whether the shadow is enabled.

int QgsTextShadowSettings::offsetAngle() const

Returns the angle for offsetting the position of the shadow from the text.

double QgsTextShadowSettings::offsetDistance() const

Returns the distance for offsetting the position of the shadow from the text.

Offset units are retrieved via offsetUnit().

bool QgsTextShadowSettings::offsetGlobal() const

Returns true if the global shadow offset will be used.

QgsMapUnitScale QgsTextShadowSettings::offsetMapUnitScale() const

Returns the map unit scale object for the shadow offset distance.

This is only used if the offsetUnit() is set to QgsUnitTypes::RenderMapUnit.

QgsUnitTypes::RenderUnit QgsTextShadowSettings::offsetUnit() const

Returns the units used for the shadow's offset.

double QgsTextShadowSettings::opacity() const

Returns the shadow's opacity.

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

void QgsTextShadowSettings::readFromLayer(QgsVectorLayer* layer)

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

Parameters
layer source vector layer

void QgsTextShadowSettings::readXml(const QDomElement& elem)

Read settings from a DOM element.

int QgsTextShadowSettings::scale() const

Returns the scaling used for the drop shadow (in percentage of original size).

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

Sets the blending mode used for drawing the drop shadow.

Parameters
mode blending mode

void QgsTextShadowSettings::setBlurAlphaOnly(bool alphaOnly)

Sets whether only the alpha channel for the shadow should be blurred.

Parameters
alphaOnly set to true to blur only the alpha channel. If false, all channels (including red, green and blue channel) will be blurred.

void QgsTextShadowSettings::setBlurRadius(double blurRadius)

Sets the blur radius for the shadow.

Parameters
blurRadius blur radius

Radius units are specified via setBlurRadiusUnits().

void QgsTextShadowSettings::setBlurRadiusMapUnitScale(const QgsMapUnitScale& scale)

Sets the map unit scale object for the shadow blur radius.

Parameters
scale scale for shadow blur radius

This is only used if the blurRadiusUnit() is set to QgsUnitTypes::RenderMapUnit.

void QgsTextShadowSettings::setBlurRadiusUnit(QgsUnitTypes::RenderUnit units)

Sets the units used for the shadow's blur radius.

Parameters
units shadow blur radius units

void QgsTextShadowSettings::setColor(const QColor& color)

Sets the color for the drop shadow.

Parameters
color shadow color

void QgsTextShadowSettings::setEnabled(bool enabled)

Sets whether the text shadow will be drawn.

Parameters
enabled set to true to draw shadow

void QgsTextShadowSettings::setOffsetAngle(int angle)

Sets the angle for offsetting the position of the shadow from the text.

Parameters
angle offset angle in degrees

void QgsTextShadowSettings::setOffsetDistance(double distance)

Sets the distance for offsetting the position of the shadow from the text.

Parameters
distance offset distance

Offset units are specified via setOffsetUnit().

void QgsTextShadowSettings::setOffsetGlobal(bool global)

Sets whether the global shadow offset should be used.

Parameters
global set to true to use global shadow offset.

void QgsTextShadowSettings::setOffsetMapUnitScale(const QgsMapUnitScale& scale)

Sets the map unit scale object for the shadow offset distance.

Parameters
scale scale for shadow offset

This is only used if the offsetUnit() is set to QgsUnitTypes::RenderMapUnit.

void QgsTextShadowSettings::setOffsetUnit(QgsUnitTypes::RenderUnit units)

Sets the units used for the shadow's offset.

Parameters
units shadow distance units

void QgsTextShadowSettings::setOpacity(double opacity)

Sets the shadow's opacity.

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

void QgsTextShadowSettings::setScale(int scale)

Sets the scaling used for the drop shadow (in percentage of original size).

Parameters
scale scale percent for drop shadow

void QgsTextShadowSettings::setShadowPlacement(QgsTextShadowSettings::ShadowPlacement placement)

Sets the placement for the drop shadow.

Parameters
placement shadow placement

The placement determines both the z-order stacking position for the shadow and the what shape (e.g., text, background shape) is used for casting the shadow.

QgsTextShadowSettings::ShadowPlacement QgsTextShadowSettings::shadowPlacement() const

Returns the placement for the drop shadow.

The placement determines both the z-order stacking position for the shadow and the what shape (e.g., text, background shape) is used for casting the shadow.

QDomElement QgsTextShadowSettings::writeXml(QDomDocument& doc) const

Write settings into a DOM element.