Class: QgsRendererRange

Represents a value range for a QgsGraduatedSymbolRenderer.

class qgis.core.QgsRendererRange[source]

Bases: object

__init__()
__init__(range: QgsClassificationRange, symbol: QgsSymbol | None, render: bool = True, uuid: str | None = '')

Creates a renderer symbol range

Parameters:
  • range (QgsClassificationRange) – The classification range

  • symbol (Optional[QgsSymbol]) – The symbol for this renderer range

  • render (bool = True) – If True, it will be renderered

  • uuid (Optional[str] = '') – Optional parameter to manually set the UUID key identifier for the this range (since QGIS 3.34).

__init__(lowerValue: float, upperValue: float, symbol: QgsSymbol | None, label: str | None, render: bool = True, uuid: str | None = '')

Creates a renderer symbol range

Parameters:
  • lowerValue (float) – The lower bound of the range

  • upperValue (float) – The upper bound of the range

  • symbol (Optional[QgsSymbol]) – The symbol for this renderer range

  • label (Optional[str]) – The label used for the range

  • render (bool = True) – If True, it will be renderered

  • uuid (Optional[str] = '') – Optional parameter to manually set the UUID key identifier for the this range (since QGIS 3.34).

__init__(range: QgsRendererRange)
Parameters:

range (QgsRendererRange)

dump(self) str[source]

Dumps a string representation of the range.

Return type:

str

label(self) str[source]

Returns the label used for the range.

See also

setLabel()

Return type:

str

lowerValue(self) float[source]

Returns the lower bound of the range.

See also

setLowerValue()

See also

upperValue()

Return type:

float

renderState(self) bool[source]

Returns True if the range should be rendered.

See also

setRenderState()

Return type:

bool

setLabel(self, label: str | None)[source]

Sets the label used for the range.

See also

label()

Parameters:

label (Optional[str])

setLowerValue(self, lowerValue: float)[source]

Sets the lower bound of the range.

See also

lowerValue()

See also

setUpperValue()

Parameters:

lowerValue (float)

setRenderState(self, render: bool)[source]

Sets whether the range should be rendered.

See also

renderState()

Parameters:

render (bool)

setSymbol(self, s: QgsSymbol | None)[source]

Sets the symbol used for the range.

Ownership of the symbol is transferred.

See also

symbol()

Parameters:

s (Optional[QgsSymbol])

setUpperValue(self, upperValue: float)[source]

Sets the upper bound of the range.

See also

upperValue()

See also

setLowerValue()

Parameters:

upperValue (float)

symbol(self) QgsSymbol | None[source]

Returns the symbol used for the range.

See also

setSymbol()

Return type:

Optional[QgsSymbol]

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any], firstRange: bool = False)[source]

Creates a DOM element representing the range in SLD format.

Parameters:
  • doc (QDomDocument) – DOM document

  • element (QDomElement) – destination DOM element

  • props (Dict[str, Any]) – graduated renderer properties

  • firstRange (bool = False) – set to True if the range is the first range, where the lower value uses a <= test rather than a < test.

Deprecated since version 3.44: Use the version with QgsSldExportContext instead.

toSld(self, doc: QDomDocument, element: QDomElement, classAttribute: Optional[str], context: QgsSldExportContext, firstRange: bool = False) -> bool Creates a DOM element representing the range in SLD format.

Parameters:
  • doc – DOM document

  • element – destination DOM element

  • classAttribute – classification attribute or expression

  • context – conversion context

  • firstRange – set to True if the range is the first range, where the lower value uses a <= test rather than a < test.

Added in version 3.44.

upperValue(self) float[source]

Returns the upper bound of the range.

See also

setUpperValue()

See also

lowerValue()

Return type:

float

uuid(self) str[source]

Returns the unique identifier for this range.

Added in version 3.34.

Return type:

str