Subgroup: Gradient

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

QgsGradientFillSymbolLayer(QgsGradientFillSymbolLayer)

Methods

angle
clone
color The fill color.
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
dataDefinedProperties Returns a reference to the symbol layer’s property collection, used for data defined overrides.
drawPreviewIcon
dxfAngle get angle
dxfBrushColor get brush/fill color
dxfBrushStyle get brush/fill style
dxfColor get color
dxfCustomDashPattern get dash pattern
dxfOffset get offset
dxfPenStyle get pen style
dxfWidth get line width
enabled Returns true if symbol layer is enabled and will be drawn.
estimateMaxBleed
fillColor Get fill color.
gradientColorType Gradient color mode, controls how gradient color stops are created
gradientSpread Gradient spread mode.
gradientType Type of gradient, e.g., linear or radial
isCompatibleWithSymbol Returns if the layer can be used below the specified symbol
isLocked
layerType
mapUnitScale
offset
offsetMapUnitScale
offsetUnit
ogrFeatureStyle
outputUnit
paintEffect Returns the current paint effect for the layer.
prepareExpressions Prepares all data defined property expressions for evaluation.
properties
propertyDefinitions Returns the symbol layer property definitions.
referencePoint1
referencePoint1IsCentroid
referencePoint2
referencePoint2IsCentroid
renderPolygon
renderingPass
restoreOldDataDefinedProperties
setAngle
setColor The fill color.
setColor2
setColorRamp Sets the color ramp used for the gradient fill.
setCoordinateMode
setDataDefinedProperties Sets the symbol layer’s property collection, used for data defined overrides.
setDataDefinedProperty Sets a data defined property for the layer.
setEnabled Sets whether symbol layer is enabled and should be drawn.
setFillColor Set fill color.
setGradientColorType
setGradientSpread
setGradientType
setLocked
setMapUnitScale
setOffset Offset for gradient fill
setOffsetMapUnitScale
setOffsetUnit Units for gradient fill offset
setOutputUnit
setPaintEffect Sets the current paint effect for the layer.
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
setRenderingPass
setStrokeColor Set stroke color.
setSubSymbol set layer’s subsymbol. takes ownership of the passed symbol
startRender
stopRender
strokeColor Get stroke color.
subSymbol Returns the symbol’s sub symbol, if present.
toSld
type
usedAttributes Returns the set of attributes referenced by the layer.
writeDxf write as DXF

Attributes

ColorRamp
Conical
Feature
Linear
Pad
PropertyAngle
PropertyArrowHeadLength
PropertyArrowHeadThickness
PropertyArrowHeadType
PropertyArrowStartWidth
PropertyArrowType
PropertyArrowWidth
PropertyBlurRadius
PropertyCapStyle
PropertyCharacter
PropertyCoordinateMode
PropertyCustomDash
PropertyDisplacementX
PropertyDisplacementY
PropertyDistanceX
PropertyDistanceY
PropertyFile
PropertyFillColor
PropertyFillStyle
PropertyGradientReference1IsCentroid
PropertyGradientReference1X
PropertyGradientReference1Y
PropertyGradientReference2IsCentroid
PropertyGradientReference2X
PropertyGradientReference2Y
PropertyGradientSpread
PropertyGradientType
PropertyHeight
PropertyHorizontalAnchor
PropertyInterval
PropertyJoinStyle
PropertyLayerEnabled
PropertyLineAngle
PropertyLineDistance
PropertyName
PropertyOffset
PropertyOffsetAlongLine
PropertyOpacity
PropertyPlacement
PropertyPreserveAspectRatio
PropertySecondaryColor
PropertyShapeburstIgnoreRings
PropertyShapeburstMaxDistance
PropertyShapeburstUseWholeShape
PropertySize
PropertyStrokeColor
PropertyStrokeStyle
PropertyStrokeWidth
PropertyVerticalAnchor
PropertyWidth
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)