QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsTextShadowSettings Class Reference

Container for settings relating to a text shadow. More...

#include <qgstextshadowsettings.h>

Public Types

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

Public Member Functions

 QgsTextShadowSettings ()
 
 QgsTextShadowSettings (const QgsTextShadowSettings &other)
 
 ~QgsTextShadowSettings ()
 
QPainter::CompositionMode blendMode () const
 Returns the blending mode used for drawing the drop shadow.
 
bool blurAlphaOnly () const
 Returns whether only the alpha channel for the shadow will be blurred.
 
double blurRadius () const
 Returns the blur radius for the shadow.
 
QgsMapUnitScale blurRadiusMapUnitScale () const
 Returns the map unit scale object for the shadow blur radius.
 
Qgis::RenderUnit blurRadiusUnit () const
 Returns the units used for the shadow's blur radius.
 
QColor color () const
 Returns the color of the drop shadow.
 
bool enabled () const
 Returns whether the shadow is enabled.
 
int offsetAngle () const
 Returns the angle for offsetting the position of the shadow from the text.
 
double offsetDistance () const
 Returns the distance for offsetting the position of the shadow from the text.
 
bool offsetGlobal () const
 Returns true if the global shadow offset will be used.
 
QgsMapUnitScale offsetMapUnitScale () const
 Returns the map unit scale object for the shadow offset distance.
 
Qgis::RenderUnit offsetUnit () const
 Returns the units used for the shadow's offset.
 
double opacity () const
 Returns the shadow's opacity.
 
bool operator!= (const QgsTextShadowSettings &other) const
 
QgsTextShadowSettingsoperator= (const QgsTextShadowSettings &other)
 
bool operator== (const QgsTextShadowSettings &other) const
 
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.
 
QSet< QString > referencedFields (const QgsRenderContext &context) const
 Returns all field names referenced by the configuration (e.g.
 
int scale () const
 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 (Qgis::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 (Qgis::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.
 
QgsTextShadowSettings::ShadowPlacement shadowPlacement () const
 Returns the placement for the drop shadow.
 
void updateDataDefinedProperties (QgsRenderContext &context, const QgsPropertyCollection &properties)
 Updates the format by evaluating current values of data defined properties.
 
QDomElement writeXml (QDomDocument &doc) const
 Write settings into a DOM element.
 

Detailed Description

Container for settings relating to a text shadow.

Note
QgsTextShadowSettings objects are implicitly shared.

Definition at line 35 of file qgstextshadowsettings.h.

Member Enumeration Documentation

◆ ShadowPlacement

Placement positions for text shadow.

Enumerator
ShadowLowest 

Draw shadow below all text components.

ShadowText 

Draw shadow under text.

ShadowBuffer 

Draw shadow under buffer.

ShadowShape 

Draw shadow under background shape.

Definition at line 42 of file qgstextshadowsettings.h.

Constructor & Destructor Documentation

◆ QgsTextShadowSettings() [1/2]

QgsTextShadowSettings::QgsTextShadowSettings ( )

Definition at line 26 of file qgstextshadowsettings.cpp.

◆ QgsTextShadowSettings() [2/2]

QgsTextShadowSettings::QgsTextShadowSettings ( const QgsTextShadowSettings other)

Definition at line 31 of file qgstextshadowsettings.cpp.

◆ ~QgsTextShadowSettings()

QgsTextShadowSettings::~QgsTextShadowSettings ( )

Definition at line 43 of file qgstextshadowsettings.cpp.

Member Function Documentation

◆ blendMode()

QPainter::CompositionMode QgsTextShadowSettings::blendMode ( ) const

Returns the blending mode used for drawing the drop shadow.

See also
setBlendMode()

Definition at line 215 of file qgstextshadowsettings.cpp.

◆ blurAlphaOnly()

bool QgsTextShadowSettings::blurAlphaOnly ( ) const

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

See also
setBlurAlphaOnly()

Definition at line 175 of file qgstextshadowsettings.cpp.

◆ blurRadius()

double QgsTextShadowSettings::blurRadius ( ) const

Returns the blur radius for the shadow.

Radius units are retrieved via blurRadiusUnits().

See also
setBlurRadius()
blurRadiusUnit()

Definition at line 145 of file qgstextshadowsettings.cpp.

◆ blurRadiusMapUnitScale()

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.

See also
setBlurRadiusMapUnitScale()
blurRadiusUnit()

Definition at line 165 of file qgstextshadowsettings.cpp.

◆ blurRadiusUnit()

Qgis::RenderUnit QgsTextShadowSettings::blurRadiusUnit ( ) const

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

See also
setBlurRadiusUnit()
blurRadius()

Definition at line 155 of file qgstextshadowsettings.cpp.

◆ color()

QColor QgsTextShadowSettings::color ( ) const

Returns the color of the drop shadow.

See also
setColor()

Definition at line 205 of file qgstextshadowsettings.cpp.

◆ enabled()

bool QgsTextShadowSettings::enabled ( ) const

Returns whether the shadow is enabled.

See also
setEnabled()

Definition at line 75 of file qgstextshadowsettings.cpp.

◆ offsetAngle()

int QgsTextShadowSettings::offsetAngle ( ) const

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

See also
setOffsetAngle
offsetDistance()

Definition at line 95 of file qgstextshadowsettings.cpp.

◆ offsetDistance()

double QgsTextShadowSettings::offsetDistance ( ) const

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

Offset units are retrieved via offsetUnit().

See also
setOffsetDistance()
offsetUnit()

Definition at line 105 of file qgstextshadowsettings.cpp.

◆ offsetGlobal()

bool QgsTextShadowSettings::offsetGlobal ( ) const

Returns true if the global shadow offset will be used.

See also
setOffsetGlobal()

Definition at line 135 of file qgstextshadowsettings.cpp.

◆ offsetMapUnitScale()

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.

See also
setOffsetMapUnitScale()
offsetUnit()

Definition at line 125 of file qgstextshadowsettings.cpp.

◆ offsetUnit()

Qgis::RenderUnit QgsTextShadowSettings::offsetUnit ( ) const

Returns the units used for the shadow's offset.

See also
setOffsetUnit()
offsetDistance()

Definition at line 115 of file qgstextshadowsettings.cpp.

◆ opacity()

double QgsTextShadowSettings::opacity ( ) const

Returns the shadow's opacity.

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

See also
setOpacity()

Definition at line 185 of file qgstextshadowsettings.cpp.

◆ operator!=()

bool QgsTextShadowSettings::operator!= ( const QgsTextShadowSettings other) const

Definition at line 70 of file qgstextshadowsettings.cpp.

◆ operator=()

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

Definition at line 37 of file qgstextshadowsettings.cpp.

◆ operator==()

bool QgsTextShadowSettings::operator== ( const QgsTextShadowSettings other) const

Definition at line 48 of file qgstextshadowsettings.cpp.

◆ readFromLayer()

void QgsTextShadowSettings::readFromLayer ( QgsVectorLayer layer)

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

Parameters
layersource vector layer

Definition at line 225 of file qgstextshadowsettings.cpp.

◆ readXml()

void QgsTextShadowSettings::readXml ( const QDomElement &  elem)

Read settings from a DOM element.

See also
writeXml()

Definition at line 291 of file qgstextshadowsettings.cpp.

◆ referencedFields()

QSet< QString > QgsTextShadowSettings::referencedFields ( const QgsRenderContext context) const

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

from data defined properties).

Since
QGIS 3.14

Definition at line 473 of file qgstextshadowsettings.cpp.

◆ scale()

int QgsTextShadowSettings::scale ( ) const

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

See also
setScale()

Definition at line 195 of file qgstextshadowsettings.cpp.

◆ setBlendMode()

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

Sets the blending mode used for drawing the drop shadow.

Parameters
modeblending mode
See also
blendMode()

Definition at line 220 of file qgstextshadowsettings.cpp.

◆ setBlurAlphaOnly()

void QgsTextShadowSettings::setBlurAlphaOnly ( bool  alphaOnly)

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

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

Definition at line 180 of file qgstextshadowsettings.cpp.

◆ setBlurRadius()

void QgsTextShadowSettings::setBlurRadius ( double  blurRadius)

Sets the blur radius for the shadow.

Radius units are specified via setBlurRadiusUnits().

Parameters
blurRadiusblur radius
See also
blurRadius()
setBlurRadiusUnit()

Definition at line 150 of file qgstextshadowsettings.cpp.

◆ setBlurRadiusMapUnitScale()

void QgsTextShadowSettings::setBlurRadiusMapUnitScale ( const QgsMapUnitScale scale)

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

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

Parameters
scalescale for shadow blur radius
See also
blurRadiusMapUnitScale()
setBlurRadiusUnit()

Definition at line 170 of file qgstextshadowsettings.cpp.

◆ setBlurRadiusUnit()

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

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

Parameters
unitsshadow blur radius units
See also
blurRadiusUnit()
setBlurRadius()

Definition at line 160 of file qgstextshadowsettings.cpp.

◆ setColor()

void QgsTextShadowSettings::setColor ( const QColor &  color)

Sets the color for the drop shadow.

Parameters
colorshadow color
See also
color()

Definition at line 210 of file qgstextshadowsettings.cpp.

◆ setEnabled()

void QgsTextShadowSettings::setEnabled ( bool  enabled)

Sets whether the text shadow will be drawn.

Parameters
enabledset to true to draw shadow
See also
enabled()

Definition at line 80 of file qgstextshadowsettings.cpp.

◆ setOffsetAngle()

void QgsTextShadowSettings::setOffsetAngle ( int  angle)

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

Parameters
angleoffset angle in degrees
See also
offsetAngle()
setOffsetDistance()

Definition at line 100 of file qgstextshadowsettings.cpp.

◆ setOffsetDistance()

void QgsTextShadowSettings::setOffsetDistance ( double  distance)

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

Offset units are specified via setOffsetUnit().

Parameters
distanceoffset distance
See also
offsetDistance()
setOffsetUnit()

Definition at line 110 of file qgstextshadowsettings.cpp.

◆ setOffsetGlobal()

void QgsTextShadowSettings::setOffsetGlobal ( bool  global)

Sets whether the global shadow offset should be used.

Parameters
globalset to true to use global shadow offset.

Definition at line 140 of file qgstextshadowsettings.cpp.

◆ setOffsetMapUnitScale()

void QgsTextShadowSettings::setOffsetMapUnitScale ( const QgsMapUnitScale scale)

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

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

Parameters
scalescale for shadow offset
See also
offsetMapUnitScale()
setOffsetUnit()

Definition at line 130 of file qgstextshadowsettings.cpp.

◆ setOffsetUnit()

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

Sets the units used for the shadow's offset.

Parameters
unitsshadow distance units
See also
offsetUnit()
setOffsetDistance()

Definition at line 120 of file qgstextshadowsettings.cpp.

◆ setOpacity()

void QgsTextShadowSettings::setOpacity ( double  opacity)

Sets the shadow's opacity.

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

Definition at line 190 of file qgstextshadowsettings.cpp.

◆ setScale()

void QgsTextShadowSettings::setScale ( int  scale)

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

Parameters
scalescale percent for drop shadow
See also
scale()

Definition at line 200 of file qgstextshadowsettings.cpp.

◆ setShadowPlacement()

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

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

Parameters
placementshadow placement
See also
shadowPlacement()

Definition at line 90 of file qgstextshadowsettings.cpp.

◆ shadowPlacement()

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.

See also
setShadowPlacement()

Definition at line 85 of file qgstextshadowsettings.cpp.

◆ updateDataDefinedProperties()

void QgsTextShadowSettings::updateDataDefinedProperties ( QgsRenderContext context,
const QgsPropertyCollection properties 
)

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

Since
QGIS 3.10

Definition at line 380 of file qgstextshadowsettings.cpp.

◆ writeXml()

QDomElement QgsTextShadowSettings::writeXml ( QDomDocument &  doc) const

Write settings into a DOM element.

See also
readXml()

Definition at line 359 of file qgstextshadowsettings.cpp.


The documentation for this class was generated from the following files: