Class: QgsShadowEffect

Base class for paint effects which render offset, blurred shadows.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: QgsPaintEffect.clone(), exteriorShadow(), QgsPaintEffect.type()

Class Hierarchy

Inheritance diagram of qgis.core.QgsShadowEffect

Base classes

QgsPaintEffect

Base class for visual effects which can be applied to QPicture drawings.

Subclasses

QgsDropShadowEffect

A paint effect which draws an offset and optionally blurred drop shadow.

QgsInnerShadowEffect

A paint effect which draws an offset and optionally blurred drop shadow within a picture.

Abstract Methods

exteriorShadow

Specifies whether the shadow is drawn outside the picture or within the picture.

Methods

blendMode

Returns the blend mode for the effect

blurLevel

Returns the blur level (radius) for the shadow.

blurMapUnitScale

Returns the map unit scale used for the shadow blur strength (radius).

blurUnit

Returns the units used for the shadow blur level (radius).

color

Returns the color used for the shadow.

offsetAngle

Returns the angle used for offsetting the shadow.

offsetDistance

Returns the distance used for offsetting the shadow.

offsetMapUnitScale

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

offsetUnit

Returns the units used for the shadow offset distance.

opacity

Returns the opacity for the effect.

setBlendMode

Sets the blend mode for the effect

setBlurLevel

Sets blur level (radius) for the shadow.

setBlurMapUnitScale

Sets the map unit scale used for the shadow blur strength (radius).

setBlurUnit

Sets the units used for the shadow blur level (radius).

setColor

Sets the color for the shadow.

setOffsetAngle

Sets the angle for offsetting the shadow.

setOffsetDistance

Sets the distance for offsetting the shadow.

setOffsetMapUnitScale

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

setOffsetUnit

Sets the units used for the shadow offset distance.

setOpacity

Sets the opacity for the effect.

class qgis.core.QgsShadowEffect[source]

Bases: QgsPaintEffect

blendMode(self) QPainter.CompositionMode[source]

Returns the blend mode for the effect

Return type:

QPainter.CompositionMode

Returns:

blend mode used for drawing the effect on to a destination paint device

See also

setBlendMode()

blurLevel(self) float[source]

Returns the blur level (radius) for the shadow.

Return type:

float

Returns:

blur level. values indicating greater blur strength.

See also

setBlurLevel()

See also

blurUnit()

blurMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale used for the shadow blur strength (radius).

Return type:

QgsMapUnitScale

Returns:

map unit scale for blur strength

See also

blurLevel()

See also

blurUnit()

Added in version 3.4.9.

blurUnit(self) Qgis.RenderUnit[source]

Returns the units used for the shadow blur level (radius).

Return type:

Qgis.RenderUnit

Returns:

units for blur level

See also

setBlurUnit()

See also

blurLevel()

Added in version 3.4.9.

color(self) QColor[source]

Returns the color used for the shadow.

Return type:

QColor

Returns:

shadow color

See also

setColor()

abstract exteriorShadow(self) bool[source]

Specifies whether the shadow is drawn outside the picture or within the picture.

Return type:

bool

Returns:

True if shadow is to be drawn outside the picture, or False to draw shadow within the picture

offsetAngle(self) int[source]

Returns the angle used for offsetting the shadow.

Return type:

int

Returns:

offset angle in degrees clockwise from North

See also

setOffsetAngle()

See also

offsetDistance()

offsetDistance(self) float[source]

Returns the distance used for offsetting the shadow.

Return type:

float

Returns:

offset distance. Distance units are retrieved via offsetUnit()

See also

offsetUnit()

offsetMapUnitScale(self) QgsMapUnitScale

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

Return type:

QgsMapUnitScale

Returns:

map unit scale for offset distance

See also

offsetDistance()

See also

offsetUnit()

offsetUnit(self) Qgis.RenderUnit[source]

Returns the units used for the shadow offset distance.

Return type:

Qgis.RenderUnit

Returns:

units for offset distance

See also

setOffsetUnit()

See also

offsetDistance()

opacity(self) float[source]

Returns the opacity for the effect.

Return type:

float

Returns:

opacity value between 0 and 1 inclusive, where 0 is fully transparent and 1 is fully opaque

See also

setOpacity()

setBlendMode(self, mode: QPainter.CompositionMode)[source]

Sets the blend mode for the effect

Parameters:

mode (QPainter.CompositionMode) – blend mode used for drawing the effect on to a destination paint device

See also

blendMode()

setBlurLevel(self, level: float)[source]

Sets blur level (radius) for the shadow.

Parameters:

level (float) – blur level. values indicating greater blur strength.

See also

blurLevel()

See also

setBlurUnit()

setBlurMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale used for the shadow blur strength (radius).

Parameters:

scale (QgsMapUnitScale) – map unit scale for blur strength

See also

setBlurLevel()

See also

setBlurUnit()

Added in version 3.4.9.

setBlurUnit(self, unit: Qgis.RenderUnit)[source]

Sets the units used for the shadow blur level (radius).

Parameters:

unit (Qgis.RenderUnit) – units for blur level

See also

blurUnit()

See also

setBlurLevel()

Added in version 3.4.9.

setColor(self, color: QColor | Qt.GlobalColor)[source]

Sets the color for the shadow.

Parameters:

color (Union[QColor, Qt.GlobalColor]) – shadow color

See also

color()

setOffsetAngle(self, angle: int)[source]

Sets the angle for offsetting the shadow.

Parameters:

angle (int) – offset angle in degrees clockwise from North

See also

offsetAngle()

setOffsetDistance(self, distance: float)[source]

Sets the distance for offsetting the shadow.

Parameters:

distance (float) – offset distance. Units are specified via setOffsetUnit()

See also

offsetDistance()

See also

setOffsetUnit()

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)[source]

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

Parameters:

scale (QgsMapUnitScale) – map unit scale for offset distance

See also

setOffsetUnit()

setOffsetUnit(self, unit: Qgis.RenderUnit)[source]

Sets the units used for the shadow offset distance.

Parameters:

unit (Qgis.RenderUnit) – units for offset distance

See also

offsetUnit()

setOpacity(self, opacity: float)[source]

Sets the opacity for the effect.

Parameters:

opacity (float) – double between 0 and 1 inclusive, where 0 is fully transparent and 1 is fully opaque

See also

opacity()