Class: QgsGlowEffect

Base class for paint effects which draw a glow inside or outside a picture.

Note

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

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsGlowEffect

Base classes

QgsPaintEffect

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

Subclasses

QgsInnerGlowEffect

A paint effect which draws a glow within a picture.

QgsOuterGlowEffect

A paint effect which draws a glow outside of a picture.

class qgis.core.QgsGlowEffect[source]

Bases: QgsPaintEffect

ColorRamp = 1
class GlowColorType

Bases: int

SingleColor = 0
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 glow.

Return type:

float

Returns:

blur level.

See also

setBlurLevel()

See also

blurUnit()

blurMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale used for the glow 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 glow 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 for the glow. This only applies if the colorType() is set to SingleColor. The glow will fade between the specified color and a totally transparent version of the color.

Return type:

QColor

Returns:

glow color

See also

setColor()

See also

colorType()

colorType(self) QgsGlowEffect.GlowColorType[source]

Returns the color mode used for the glow. The glow can either be drawn using a QgsColorRamp color ramp or by specificing a single color.

Return type:

QgsGlowEffect.GlowColorType

Returns:

current color mode used for the glow

See also

setColorType()

See also

color()

See also

ramp()

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()

ramp(self) QgsColorRamp | None[source]

Returns the color ramp used for the glow. This only applies if the colorType() is set to ColorRamp. The glow will utilize colors from the ramp.

Return type:

Optional[QgsColorRamp]

Returns:

color ramp for glow

See also

setRamp()

See also

colorType()

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 glow. This can be used to smooth the output from the glow effect.

Parameters:

level (float) – blur level.

See also

blurLevel()

See also

setBlurUnit()

setBlurMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale used for the glow 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 glow 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 glow. This only applies if the colorType() is set to SingleColor. The glow will fade between the specified color and a totally transparent version of the color.

Parameters:

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

See also

color()

See also

setColorType()

setColorType(self, colorType: QgsGlowEffect.GlowColorType)[source]

Sets the color mode to use for the glow. The glow can either be drawn using a QgsColorRamp color ramp or by simply specificing a single color. setColorType is used to specify which mode to use for the glow.

Parameters:

colorType (QgsGlowEffect.GlowColorType) – color type to use for glow

See also

colorType()

See also

setColor()

See also

setRamp()

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()

setRamp(self, ramp: QgsColorRamp | None)[source]

Sets the color ramp for the glow. This only applies if the colorType() is set to ColorRamp. The glow will utilize colors from the ramp.

Parameters:

ramp (Optional[QgsColorRamp]) – color ramp for glow. Ownership of the ramp is transferred to the effect.

See also

ramp()

See also

setColorType()

setSpread(self, spread: float)[source]

Sets the spread distance for drawing the glow effect.

Parameters:

spread (float) – spread distance. Units are specified via setSpreadUnit()

See also

spread()

See also

setSpreadUnit()

setSpreadMapUnitScale(self, scale: QgsMapUnitScale)[source]

Sets the map unit scale used for the spread distance.

Parameters:

scale (QgsMapUnitScale) – map unit scale for spread distance

See also

setSpread()

See also

setSpreadUnit()

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

Sets the units used for the glow spread distance.

Parameters:

unit (Qgis.RenderUnit) – units for spread distance

See also

spreadUnit()

See also

setSpread()

abstract shadeExterior(self) bool[source]

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

Return type:

bool

Returns:

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

spread(self) float[source]

Returns the spread distance used for drawing the glow effect.

Return type:

float

Returns:

spread distance. Units are retrieved via spreadUnit()

See also

setSpread()

See also

spreadUnit()

spreadMapUnitScale(self) QgsMapUnitScale

Returns the map unit scale used for the spread distance.

Return type:

QgsMapUnitScale

Returns:

map unit scale for spread distance

See also

spread()

See also

spreadUnit()

spreadUnit(self) Qgis.RenderUnit[source]

Returns the units used for the glow spread distance.

Return type:

Qgis.RenderUnit

Returns:

units for spread distance

See also

setSpreadUnit()

See also

spread()