Class: QgsGradientFillSymbolLayer

class qgis.core.QgsGradientFillSymbolLayer(color: Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEFILL_COLOR, color2: Union[QColor, Qt.GlobalColor] = Qt.white, gradientColorType: QgsGradientFillSymbolLayer.GradientColorType = QgsGradientFillSymbolLayer.SimpleTwoColor, gradientType: QgsGradientFillSymbolLayer.GradientType = QgsGradientFillSymbolLayer.Linear, coordinateMode: QgsGradientFillSymbolLayer.GradientCoordinateMode = QgsGradientFillSymbolLayer.Feature, gradientSpread: QgsGradientFillSymbolLayer.GradientSpread = QgsGradientFillSymbolLayer.Pad)

Bases: qgis._core.QgsFillSymbolLayer

Enums

Methods

clone

color2

Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor

colorRamp

Returns the color ramp used for the gradient fill.

coordinateMode

Coordinate mode for gradient.

copyDataDefinedProperties

copyPaintEffect

create

estimateMaxBleed

gradientColorType

Gradient color mode, controls how gradient color stops are created

gradientSpread

Gradient spread mode.

gradientType

Type of gradient, e.g., linear or radial

layerType

mapUnitScale

offset

offsetMapUnitScale

offsetUnit

outputUnit

properties

referencePoint1

referencePoint1IsCentroid

referencePoint2

referencePoint2IsCentroid

renderPolygon

restoreOldDataDefinedProperties

setColor2

setColorRamp

Sets the color ramp used for the gradient fill.

setCoordinateMode

setGradientColorType

setGradientSpread

setGradientType

setMapUnitScale

setOffset

Offset for gradient fill

setOffsetMapUnitScale

setOffsetUnit

Units for gradient fill offset

setOutputUnit

setReferencePoint1

Starting point of gradient fill, in the range [0,0] - [1,1]

setReferencePoint1IsCentroid

Sets the starting point of the gradient to be the feature centroid

setReferencePoint2

End point of gradient fill, in the range [0,0] - [1,1]

setReferencePoint2IsCentroid

Sets the end point of the gradient to be the feature centroid

startRender

stopRender

Signals

Attributes

ColorRamp

Conical

Feature

Linear

Pad

Radial

Reflect

Repeat

SimpleTwoColor

Viewport

ColorRamp = 1
Conical = 2
Feature = 0
class GradientColorType

Bases: int

class GradientCoordinateMode

Bases: int

class GradientSpread

Bases: int

class GradientType

Bases: int

Linear = 0
Pad = 0
Radial = 1
Reflect = 1
Repeat = 2
SimpleTwoColor = 0
Viewport = 1
clone(self) → QgsGradientFillSymbolLayer
color2(self) → QColor

Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor

colorRamp(self) → QgsColorRamp

Returns the color ramp used for the gradient fill. This is only used if the gradient color type is set to ColorRamp.

See also

setColorRamp()

coordinateMode(self) → QgsGradientFillSymbolLayer.GradientCoordinateMode

Coordinate mode for gradient. Controls how the gradient stops are positioned.

copyDataDefinedProperties()
copyPaintEffect()
create(properties: Dict[str, str] = {}) → QgsSymbolLayer
estimateMaxBleed(self, context: QgsRenderContext) → float
gradientColorType(self) → QgsGradientFillSymbolLayer.GradientColorType

Gradient color mode, controls how gradient color stops are created

gradientSpread(self) → QgsGradientFillSymbolLayer.GradientSpread

Gradient spread mode. Controls how the gradient behaves outside of the predefined stops

gradientType(self) → QgsGradientFillSymbolLayer.GradientType

Type of gradient, e.g., linear or radial

layerType(self) → str
mapUnitScale(self) → QgsMapUnitScale
offset(self) → QPointF
offsetMapUnitScale(self) → QgsMapUnitScale
offsetUnit(self) → QgsUnitTypes.RenderUnit
outputUnit(self) → QgsUnitTypes.RenderUnit
properties(self) → Dict[str, str]
referencePoint1(self) → QPointF
referencePoint1IsCentroid(self) → bool
referencePoint2(self) → QPointF
referencePoint2IsCentroid(self) → bool
renderPolygon(self, points: QPolygonF, rings: Iterable[QPolygonF], context: QgsSymbolRenderContext)
restoreOldDataDefinedProperties()
setColor2(self, color2: Union[QColor, Qt.GlobalColor])
setColorRamp(self, ramp: QgsColorRamp)

Sets the color ramp used for the gradient fill. This is only used if the gradient color type is set to ColorRamp.

Parameters

ramp – color ramp. Ownership is transferred.

See also

colorRamp()

setCoordinateMode(self, coordinateMode: QgsGradientFillSymbolLayer.GradientCoordinateMode)
setGradientColorType(self, gradientColorType: QgsGradientFillSymbolLayer.GradientColorType)
setGradientSpread(self, gradientSpread: QgsGradientFillSymbolLayer.GradientSpread)
setGradientType(self, gradientType: QgsGradientFillSymbolLayer.GradientType)
setMapUnitScale(self, scale: QgsMapUnitScale)
setOffset(self, offset: Union[QPointF, QPoint])

Offset for gradient fill

setOffsetMapUnitScale(self, scale: QgsMapUnitScale)
setOffsetUnit(self, unit: QgsUnitTypes.RenderUnit)

Units for gradient fill offset

setOutputUnit(self, unit: QgsUnitTypes.RenderUnit)
setReferencePoint1(self, referencePoint: Union[QPointF, QPoint])

Starting point of gradient fill, in the range [0,0] - [1,1]

setReferencePoint1IsCentroid(self, isCentroid: bool)

Sets the starting point of the gradient to be the feature centroid

setReferencePoint2(self, referencePoint: Union[QPointF, QPoint])

End point of gradient fill, in the range [0,0] - [1,1]

setReferencePoint2IsCentroid(self, isCentroid: bool)

Sets the end point of the gradient to be the feature centroid

startRender(self, context: QgsSymbolRenderContext)
stopRender(self, context: QgsSymbolRenderContext)