Class: QgsSingleSymbolRenderer

class qgis.core.QgsSingleSymbolRenderer(symbol: QgsSymbol)

Bases: qgis._core.QgsFeatureRenderer

Constructor for QgsSingleSymbolRenderer.

The same symbol will be used to render every feature. Ownership of symbol is transferred to the renderer.

Enums

Methods

accept

capabilities

clone

convertFromRenderer

Creates a new single symbol renderer from an existing renderer.

convertSymbolRotation

convertSymbolSizeScale

copyRendererData

create

Creates a new single symbol renderer from an XML element, using the supplied read/write context.

createFromSld

Creates a new single symbol renderer from an SLD element.

dataDefinedSizeLegend

Returns configuration of appearance of legend when using data-defined size for marker symbols.

dump

legendKeysForFeature

legendSymbolItems

originalSymbolForFeature

renderFeatureWithSymbol

renderVertexMarker

renderVertexMarkerPolygon

renderVertexMarkerPolyline

save

setDataDefinedSizeLegend

Configures appearance of legend when renderer is configured to use data-defined size for marker symbols.

setLegendSymbolItem

setSymbol

Sets the symbol which will be rendered for every feature.

startRender

stopRender

symbol

Returns the symbol which will be rendered for every feature.

symbolForFeature

symbols

toSld

usedAttributes

Signals

Attributes

accept(self, visitor: QgsStyleEntityVisitorInterface) → bool
capabilities(self) → QgsFeatureRenderer.Capabilities
clone(self) → QgsSingleSymbolRenderer
convertFromRenderer(renderer: QgsFeatureRenderer) → QgsSingleSymbolRenderer

Creates a new single symbol renderer from an existing renderer.

Returns

a new renderer if the conversion was possible, otherwise None.

New in version 2.5.

convertSymbolRotation()
convertSymbolSizeScale()
copyRendererData()
create(element: QDomElement, context: QgsReadWriteContext) → QgsFeatureRenderer

Creates a new single symbol renderer from an XML element, using the supplied read/write context.

The caller takes ownership of the returned renderer.

createFromSld(element: QDomElement, geomType: QgsWkbTypes.GeometryType) → QgsFeatureRenderer

Creates a new single symbol renderer from an SLD element.

The geometry type for features to be rendered must be specified via the geomType argument.

The caller takes ownership of the returned renderer.

dataDefinedSizeLegend(self) → QgsDataDefinedSizeLegend

Returns configuration of appearance of legend when using data-defined size for marker symbols. Will return None if the functionality is disabled.

New in version 3.0.

dump(self) → str
legendKeysForFeature(self, feature: QgsFeature, context: QgsRenderContext) → Set[str]
legendSymbolItems(self) → List[QgsLegendSymbolItem]
originalSymbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
renderFeatureWithSymbol()
renderVertexMarker()
renderVertexMarkerPolygon()
renderVertexMarkerPolyline()
save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement
setDataDefinedSizeLegend(self, settings: QgsDataDefinedSizeLegend)

Configures appearance of legend when renderer is configured to use data-defined size for marker symbols. This allows configuring which values (symbol sizes) should be shown in the legend, whether to display different symbol sizes collapsed in one legend node or separated across multiple legend nodes etc.

When renderer does not use data-defined size or does not use marker symbols, these settings will be ignored. Takes ownership of the passed settings objects. None is a valid input that disables data-defined size legend.

New in version 3.0.

setLegendSymbolItem(self, key: str, symbol: QgsSymbol)
setSymbol(self, s: QgsSymbol)

Sets the symbol which will be rendered for every feature. Ownership of the symbol is transferred to the renderer.

See also

symbol()

startRender(self, context: QgsRenderContext, fields: QgsFields)
stopRender(self, context: QgsRenderContext)
symbol(self) → QgsSymbol

Returns the symbol which will be rendered for every feature.

See also

setSymbol()

symbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
symbols(self, context: QgsRenderContext) → List[QgsSymbol]
toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str] = {})
usedAttributes(self, context: QgsRenderContext) → Set[str]