Class: QgsRasterRendererWidget

Abstract base class for widgets which configure a QgsRasterRenderer.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsRasterRendererWidget

Base classes

QWidget

QObject

QPaintDevice

Subclasses

QgsHillshadeRendererWidget

Renderer widget for the hill shade renderer.

QgsMultiBandColorRendererWidget

Constructor for QgsMultiBandColorRendererWidget.

QgsPalettedRendererWidget

Constructor for QgsSingleBandPseudoColorRendererWidget.

QgsRasterContourRendererWidget

Configuration widget for QgsRasterContourRenderer

QgsSingleBandGrayRendererWidget

Constructor for QgsSingleBandGrayRendererWidget.

QgsSingleBandPseudoColorRendererWidget

Single band pseudo color renderer widget consists of a color ramp shader widget, a raster min max widget and a band selector.

Methods

contrastEnhancementAlgorithm

Returns the contrast enhancement algorithm to be used by the raster renderer.

doComputations

Load programmatically with current values

mapCanvas

Returns the map canvas associated with the widget.

max

min

minMaxWidget

Returns min/max widget when it exists.

rasterLayer

Returns the raster layer associated with the widget.

renderer

Creates a new renderer, using the properties defined in the widget.

selectedBand

setContrastEnhancementAlgorithm

Sets the contrast enhancement algorithm to be used by the raster renderer.

setMapCanvas

Sets the map canvas associated with the widget.

setMax

setMin

setRasterLayer

Sets the raster layer associated with the widget.

setStdDev

stdDev

Signals

widgetChanged

Emitted when something on the widget has changed.

class qgis.gui.QgsRasterRendererWidget[source]

Bases: QWidget

__init__(layer: QgsRasterLayer | None, extent: QgsRectangle)

Constructor for QgsRasterRendererWidget.

Parameters:
contrastEnhancementAlgorithm(self) QgsContrastEnhancement.ContrastEnhancementAlgorithm[source]

Returns the contrast enhancement algorithm to be used by the raster renderer.

Added in version 3.26.

Return type:

QgsContrastEnhancement.ContrastEnhancementAlgorithm

doComputations(self)[source]

Load programmatically with current values

mapCanvas(self) QgsMapCanvas | None[source]

Returns the map canvas associated with the widget.

See also

setMapCanvas()

Return type:

Optional[QgsMapCanvas]

max(self, index: int = 0) str[source]
Parameters:

index (int = 0)

Return type:

str

min(self, index: int = 0) str[source]
Parameters:

index (int = 0)

Return type:

str

minMaxWidget(self) QgsRasterMinMaxWidget | None[source]

Returns min/max widget when it exists.

Return type:

Optional[QgsRasterMinMaxWidget]

rasterLayer(self) QgsRasterLayer | None[source]

Returns the raster layer associated with the widget.

See also

setRasterLayer()

Return type:

Optional[QgsRasterLayer]

renderer(self) QgsRasterRenderer | None[source]

Creates a new renderer, using the properties defined in the widget.

The caller takes ownership of the returned renderer.

Return type:

Optional[QgsRasterRenderer]

selectedBand(self, index: int = 0) int[source]
Parameters:

index (int = 0)

Return type:

int

setContrastEnhancementAlgorithm(self, algorithm: QgsContrastEnhancement.ContrastEnhancementAlgorithm)[source]

Sets the contrast enhancement algorithm to be used by the raster renderer.

Added in version 3.26.

Parameters:

algorithm (QgsContrastEnhancement.ContrastEnhancementAlgorithm)

setMapCanvas(self, canvas: QgsMapCanvas | None)[source]

Sets the map canvas associated with the widget. This allows the widget to retrieve the current map extent and other properties from the canvas.

Parameters:

canvas (Optional[QgsMapCanvas]) – map canvas

See also

mapCanvas()

setMax(self, value: str | None, index: int = 0)[source]
Parameters:
  • value (Optional[str])

  • index (int = 0)

setMin(self, value: str | None, index: int = 0)[source]
Parameters:
  • value (Optional[str])

  • index (int = 0)

setRasterLayer(self, layer: QgsRasterLayer | None)[source]

Sets the raster layer associated with the widget.

See also

rasterLayer()

Parameters:

layer (Optional[QgsRasterLayer])

setStdDev(self, value: str | None)[source]
Parameters:

value (Optional[str])

stdDev(self) str[source]
Return type:

str

signal widgetChanged[source]

Emitted when something on the widget has changed. All widgets will fire this event to notify of an internal change.