QGIS API Documentation  3.2.0-Bonn (bc43194)
Public Types | Public Member Functions | List of all members
QgsTextShadowSettings Class Reference

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

#include <qgstextrenderer.h>

Public Types

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

Public Member Functions

 QgsTextShadowSettings ()
 
 QgsTextShadowSettings (const QgsTextShadowSettings &other)
 Copy constructor. More...
 
 ~QgsTextShadowSettings ()
 
QPainter::CompositionMode blendMode () const
 Returns the blending mode used for drawing the drop shadow. More...
 
bool blurAlphaOnly () const
 Returns whether only the alpha channel for the shadow will be blurred. More...
 
double blurRadius () const
 Returns the blur radius for the shadow. More...
 
QgsMapUnitScale blurRadiusMapUnitScale () const
 Returns the map unit scale object for the shadow blur radius. More...
 
QgsUnitTypes::RenderUnit blurRadiusUnit () const
 Returns the units used for the shadow's blur radius. More...
 
QColor color () const
 Returns the color of the drop shadow. More...
 
bool enabled () const
 Returns whether the shadow is enabled. More...
 
int offsetAngle () const
 Returns the angle for offsetting the position of the shadow from the text. More...
 
double offsetDistance () const
 Returns the distance for offsetting the position of the shadow from the text. More...
 
bool offsetGlobal () const
 Returns true if the global shadow offset will be used. More...
 
QgsMapUnitScale offsetMapUnitScale () const
 Returns the map unit scale object for the shadow offset distance. More...
 
QgsUnitTypes::RenderUnit offsetUnit () const
 Returns the units used for the shadow's offset. More...
 
double opacity () const
 Returns the shadow's opacity. More...
 
QgsTextShadowSettingsoperator= (const QgsTextShadowSettings &other)
 
void readFromLayer (QgsVectorLayer *layer)
 Reads settings from a layer's custom properties (for QGIS 2.x projects). More...
 
void readXml (const QDomElement &elem)
 Read settings from a DOM element. More...
 
int scale () const
 Returns the scaling used for the drop shadow (in percentage of original size). More...
 
void setBlendMode (QPainter::CompositionMode mode)
 Sets the blending mode used for drawing the drop shadow. More...
 
void setBlurAlphaOnly (bool alphaOnly)
 Sets whether only the alpha channel for the shadow should be blurred. More...
 
void setBlurRadius (double blurRadius)
 Sets the blur radius for the shadow. More...
 
void setBlurRadiusMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale object for the shadow blur radius. More...
 
void setBlurRadiusUnit (QgsUnitTypes::RenderUnit units)
 Sets the units used for the shadow's blur radius. More...
 
void setColor (const QColor &color)
 Sets the color for the drop shadow. More...
 
void setEnabled (bool enabled)
 Sets whether the text shadow will be drawn. More...
 
void setOffsetAngle (int angle)
 Sets the angle for offsetting the position of the shadow from the text. More...
 
void setOffsetDistance (double distance)
 Sets the distance for offsetting the position of the shadow from the text. More...
 
void setOffsetGlobal (bool global)
 Sets whether the global shadow offset should be used. More...
 
void setOffsetMapUnitScale (const QgsMapUnitScale &scale)
 Sets the map unit scale object for the shadow offset distance. More...
 
void setOffsetUnit (QgsUnitTypes::RenderUnit units)
 Sets the units used for the shadow's offset. More...
 
void setOpacity (double opacity)
 Sets the shadow's opacity. More...
 
void setScale (int scale)
 Sets the scaling used for the drop shadow (in percentage of original size). More...
 
void setShadowPlacement (QgsTextShadowSettings::ShadowPlacement placement)
 Sets the placement for the drop shadow. More...
 
QgsTextShadowSettings::ShadowPlacement shadowPlacement () const
 Returns the placement for the drop shadow. More...
 
QDomElement writeXml (QDomDocument &doc) const
 Write settings into a DOM element. More...
 

Detailed Description

Container for settings relating to a text shadow.

Note
QgsTextShadowSettings objects are implicitly shared.
Since
QGIS 3.0

Definition at line 697 of file qgstextrenderer.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 704 of file qgstextrenderer.h.

Constructor & Destructor Documentation

◆ QgsTextShadowSettings() [1/2]

QgsTextShadowSettings::QgsTextShadowSettings ( )

Definition at line 904 of file qgstextrenderer.cpp.

◆ QgsTextShadowSettings() [2/2]

QgsTextShadowSettings::QgsTextShadowSettings ( const QgsTextShadowSettings other)

Copy constructor.

Parameters
othersource QgsTextShadowSettings

Definition at line 909 of file qgstextrenderer.cpp.

◆ ~QgsTextShadowSettings()

QgsTextShadowSettings::~QgsTextShadowSettings ( )

Definition at line 921 of file qgstextrenderer.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 1066 of file qgstextrenderer.cpp.

◆ blurAlphaOnly()

bool QgsTextShadowSettings::blurAlphaOnly ( ) const

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

See also
setBlurAlphaOnly()

Definition at line 1026 of file qgstextrenderer.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 996 of file qgstextrenderer.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 1016 of file qgstextrenderer.cpp.

◆ blurRadiusUnit()

QgsUnitTypes::RenderUnit QgsTextShadowSettings::blurRadiusUnit ( ) const

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

See also
setBlurRadiusUnit()
blurRadius()

Definition at line 1006 of file qgstextrenderer.cpp.

◆ color()

QColor QgsTextShadowSettings::color ( ) const

Returns the color of the drop shadow.

See also
setColor()

Definition at line 1056 of file qgstextrenderer.cpp.

◆ enabled()

bool QgsTextShadowSettings::enabled ( ) const

Returns whether the shadow is enabled.

See also
setEnabled()

Definition at line 926 of file qgstextrenderer.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 946 of file qgstextrenderer.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 956 of file qgstextrenderer.cpp.

◆ offsetGlobal()

bool QgsTextShadowSettings::offsetGlobal ( ) const

Returns true if the global shadow offset will be used.

See also
setOffsetGlobal()

Definition at line 986 of file qgstextrenderer.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 976 of file qgstextrenderer.cpp.

◆ offsetUnit()

QgsUnitTypes::RenderUnit QgsTextShadowSettings::offsetUnit ( ) const

Returns the units used for the shadow's offset.

See also
setOffsetUnit()
offsetDistance()

Definition at line 966 of file qgstextrenderer.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 1036 of file qgstextrenderer.cpp.

◆ operator=()

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

Definition at line 915 of file qgstextrenderer.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 1076 of file qgstextrenderer.cpp.

◆ readXml()

void QgsTextShadowSettings::readXml ( const QDomElement &  elem)

Read settings from a DOM element.

See also
writeXml()

Definition at line 1142 of file qgstextrenderer.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 1046 of file qgstextrenderer.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 1071 of file qgstextrenderer.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 1031 of file qgstextrenderer.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 1001 of file qgstextrenderer.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 1021 of file qgstextrenderer.cpp.

◆ setBlurRadiusUnit()

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

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

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

Definition at line 1011 of file qgstextrenderer.cpp.

◆ setColor()

void QgsTextShadowSettings::setColor ( const QColor &  color)

Sets the color for the drop shadow.

Parameters
colorshadow color
See also
color()

Definition at line 1061 of file qgstextrenderer.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 931 of file qgstextrenderer.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 951 of file qgstextrenderer.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 961 of file qgstextrenderer.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 991 of file qgstextrenderer.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 981 of file qgstextrenderer.cpp.

◆ setOffsetUnit()

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

Sets the units used for the shadow's offset.

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

Definition at line 971 of file qgstextrenderer.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 1041 of file qgstextrenderer.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 1051 of file qgstextrenderer.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 941 of file qgstextrenderer.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 936 of file qgstextrenderer.cpp.

◆ writeXml()

QDomElement QgsTextShadowSettings::writeXml ( QDomDocument &  doc) const

Write settings into a DOM element.

See also
readXml()

Definition at line 1210 of file qgstextrenderer.cpp.


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