Class: QgsGradientFillSymbolLayer¶
A fill symbol layer which draws a smooth color gradient over a polygon.
Class Hierarchy¶
Base classes¶
Abstract base class for fill symbol layers. |
|
Abstract base class for symbol layers. |
Enums
alias of |
|
alias of |
|
Gradient spread options, which control how gradients are rendered outside of their start and end points. |
|
Gradient types. |
Methods
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor. |
|
Returns the color ramp used for the gradient fill. |
|
Returns the coordinate mode for gradient, which controls how the gradient stops are positioned. |
|
Returns the gradient color mode, which controls how gradient color stops are created. |
|
Returns the gradient spread mode, which controls how the gradient behaves outside of the predefined stops. |
|
Returns the type of gradient, e.g., linear or radial. |
|
Returns the offset by which polygons will be translated during rendering. |
|
Returns the map unit scale for the fill's offset. |
|
Returns the units for the fill's offset. |
|
Returns the starting point of gradient fill, in the range [0,0] - [1,1]. |
|
Returns whether the starting point for the gradient is taken from the feature centroid. |
|
Returns the end point of gradient fill, in the range [0,0] - [1,1]. |
|
Returns whether the end point for the gradient is taken from the feature centroid. |
|
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor. |
|
Sets the color ramp used for the gradient fill. |
|
Sets the coordinate mode for gradient, which controls how the gradient stops are positioned. |
|
Sets the gradient color mode, which controls how gradient color stops are created. |
|
Sets the gradient spread mode, which controls how the gradient behaves outside of the predefined stops. |
|
Sets the type of gradient, e.g., linear or radial. |
|
Sets an offset by which polygons will be translated during rendering. |
|
Sets the map unit scale for the fill's offset. |
|
Sets the unit for the fill's offset. |
|
Sets the starting point of gradient fill, in the range [0,0] - [1,1]. |
|
Sets whether the starting point for the gradient is taken from the feature centroid. |
|
Sets the end point of gradient fill, in the range [0,0] - [1,1]. |
|
Sets whether the end point for the gradient is taken from the feature centroid. |
Static Methods
Creates a new |
- class qgis.core.QgsGradientFillSymbolLayer[source]¶
Bases:
QgsFillSymbolLayer
- __init__(color: QColor | Qt.GlobalColor = DEFAULT_SIMPLEFILL_COLOR, color2: QColor | Qt.GlobalColor = Qt.white, gradientColorType: Qgis.GradientColorSource = Qgis.GradientColorSource.SimpleTwoColor, gradientType: Qgis.GradientType = Qgis.GradientType.Linear, coordinateMode: Qgis.SymbolCoordinateReference = Qgis.SymbolCoordinateReference.Feature, gradientSpread: Qgis.GradientSpread = Qgis.GradientSpread.Pad)
Constructor for QgsGradientFillSymbolLayer.
- Parameters:
color (Union[QColor, Qt.GlobalColor] = DEFAULT_SIMPLEFILL_COLOR)
color2 (Union[QColor, Qt.GlobalColor] = Qt.white)
gradientColorType (Qgis.GradientColorSource = Qgis.GradientColorSource.SimpleTwoColor)
gradientType (Qgis.GradientType = Qgis.GradientType.Linear)
coordinateMode (Qgis.SymbolCoordinateReference = Qgis.SymbolCoordinateReference.Feature)
gradientSpread (Qgis.GradientSpread = Qgis.GradientSpread.Pad)
- GradientColorType¶
alias of
GradientColorSource
- GradientCoordinateMode¶
alias of
SymbolCoordinateReference
- class GradientSpread(*values)¶
Bases:
IntEnum
Gradient spread options, which control how gradients are rendered outside of their start and end points.
Note
Prior to QGIS 3.24 this was available as
QgsGradientFillSymbolLayer
.GradientSpreadAdded in version 3.24.
Pad
: Pad out gradient using colors at endpoint of gradientReflect
: Reflect gradientRepeat
: Repeat gradient
- class GradientType(*values)¶
Bases:
IntEnum
Gradient types.
Note
Prior to QGIS 3.24 this was available as
QgsGradientFillSymbolLayer
.GradientTypeAdded in version 3.24.
Linear
: Linear gradientRadial
: Radial (circular) gradientConical
: Conical (polar) gradient
- color2(self) QColor [source]¶
Returns the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
See also
- Return type:
QColor
- colorRamp(self) QgsColorRamp | None [source]¶
Returns the color ramp used for the gradient fill. This is only used if the gradient color type is set to ColorRamp.
See also
See also
- Return type:
Optional[QgsColorRamp]
- coordinateMode(self) Qgis.SymbolCoordinateReference [source]¶
Returns the coordinate mode for gradient, which controls how the gradient stops are positioned.
See also
- Return type:
- static create(properties: Dict[str, Any] = {}) QgsSymbolLayer | None [source]¶
Creates a new
QgsGradientFillSymbolLayer
using the specifiedproperties
map containing symbol properties (seeproperties()
).Caller takes ownership of the returned symbol layer.
- Parameters:
properties (Dict[str, Any] = {})
- Return type:
Optional[QgsSymbolLayer]
- gradientColorType(self) Qgis.GradientColorSource [source]¶
Returns the gradient color mode, which controls how gradient color stops are created.
See also
- Return type:
- gradientSpread(self) Qgis.GradientSpread [source]¶
Returns the gradient spread mode, which controls how the gradient behaves outside of the predefined stops.
See also
- Return type:
- gradientType(self) Qgis.GradientType [source]¶
Returns the type of gradient, e.g., linear or radial.
See also
- Return type:
- offset(self) QPointF [source]¶
Returns the offset by which polygons will be translated during rendering.
Units are specified by
offsetUnit()
.See also
See also
- Return type:
QPointF
- offsetMapUnitScale(self) QgsMapUnitScale ¶
Returns the map unit scale for the fill’s offset.
See also
See also
- Return type:
- offsetUnit(self) Qgis.RenderUnit [source]¶
Returns the units for the fill’s offset.
See also
See also
- Return type:
- referencePoint1(self) QPointF [source]¶
Returns the starting point of gradient fill, in the range [0,0] - [1,1].
See also
- Return type:
QPointF
- referencePoint1IsCentroid(self) bool [source]¶
Returns whether the starting point for the gradient is taken from the feature centroid.
See also
- Return type:
bool
- referencePoint2(self) QPointF [source]¶
Returns the end point of gradient fill, in the range [0,0] - [1,1].
See also
- Return type:
QPointF
- referencePoint2IsCentroid(self) bool [source]¶
Returns whether the end point for the gradient is taken from the feature centroid.
See also
- Return type:
bool
- setColor2(self, color2: QColor | Qt.GlobalColor)[source]¶
Sets the color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor.
See also
- Parameters:
color2 (Union[QColor, Qt.GlobalColor])
- setColorRamp(self, ramp: QgsColorRamp | None)[source]¶
Sets the color ramp used for the gradient fill. This is only used if the gradient color type is set to ColorRamp.
- Parameters:
ramp (Optional[QgsColorRamp]) – color ramp. Ownership is transferred.
See also
See also
- setCoordinateMode(self, coordinateMode: Qgis.SymbolCoordinateReference)[source]¶
Sets the coordinate mode for gradient, which controls how the gradient stops are positioned.
See also
- Parameters:
coordinateMode (Qgis.SymbolCoordinateReference)
- setGradientColorType(self, gradientColorType: Qgis.GradientColorSource)[source]¶
Sets the gradient color mode, which controls how gradient color stops are created.
See also
- Parameters:
gradientColorType (Qgis.GradientColorSource)
- setGradientSpread(self, gradientSpread: Qgis.GradientSpread)[source]¶
Sets the gradient spread mode, which controls how the gradient behaves outside of the predefined stops.
See also
- Parameters:
gradientSpread (Qgis.GradientSpread)
- setGradientType(self, gradientType: Qgis.GradientType)[source]¶
Sets the type of gradient, e.g., linear or radial.
See also
- Parameters:
gradientType (Qgis.GradientType)
- setOffset(self, offset: QPointF | QPoint)[source]¶
Sets an
offset
by which polygons will be translated during rendering.Units are specified by
offsetUnit()
.See also
See also
- Parameters:
offset (Union[QPointF, QPoint])
- setOffsetMapUnitScale(self, scale: QgsMapUnitScale)[source]¶
Sets the map unit
scale
for the fill’s offset.See also
See also
- Parameters:
scale (QgsMapUnitScale)
- setOffsetUnit(self, unit: Qgis.RenderUnit)[source]¶
Sets the
unit
for the fill’s offset.See also
See also
- Parameters:
unit (Qgis.RenderUnit)
- setReferencePoint1(self, referencePoint: QPointF | QPoint)[source]¶
Sets the starting point of gradient fill, in the range [0,0] - [1,1].
See also
- Parameters:
referencePoint (Union[QPointF, QPoint])
- setReferencePoint1IsCentroid(self, isCentroid: bool)[source]¶
Sets whether the starting point for the gradient is taken from the feature centroid.
See also
- Parameters:
isCentroid (bool)
- setReferencePoint2(self, referencePoint: QPointF | QPoint)[source]¶
Sets the end point of gradient fill, in the range [0,0] - [1,1].
See also
- Parameters:
referencePoint (Union[QPointF, QPoint])