Class: QgsColorRampShaderWidget

A widget for configuring numeric ranges associated with a color ramp.

It has 2 ways how to use it. For raster layers, raster data provider and band is assigned and the Quantile classification mode can be used and the LoadFromBandButton is visible.

The other mode is used to style mesh layer contours (scalar datasets)

Added in version 3.4.

QgsColorRampShaderWidget

QgsColorRampShaderWidget

Class Hierarchy

Inheritance diagram of qgis.gui.QgsColorRampShaderWidget

Base classes

QWidget

QObject

QPaintDevice

class qgis.gui.QgsColorRampShaderWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Creates new color ramp shader widget

Parameters:

parent (Optional[QWidget] = None)

signal classificationModeChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

classify(self)[source]

Executes the single band pseudo raster classification

initializeForUseWithRasterLayer(self)[source]

Allows quantile classification mode for raster layers

loadMinimumMaximumFromTree(self)[source]

Loads min and max values from color ramp tree

maximum(self) float[source]

Gets max value

Return type:

float

minimum(self) float[source]

Gets min value

Return type:

float

signal minimumMaximumChangedFromTree[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

populateColormapTreeWidget(self, colorRampItems: Iterable[QgsColorRampShader.ColorRampItem])[source]

Populates color ramp tree from ramp items

Parameters:

colorRampItems (Iterable[QgsColorRampShader.ColorRampItem])

setExtent(self, extent: QgsRectangle)[source]

Sets extent, only when used for raster layer

Parameters:

extent (QgsRectangle)

setFromShader(self, colorRampShader: QgsColorRampShader)[source]

Sets widget state from the color ramp shader

Parameters:

colorRampShader (QgsColorRampShader)

setMinimumMaximum(self, minimum: float, maximum: float)[source]

Sets min max

Parameters:
  • minimum (float)

  • maximum (float)

setMinimumMaximumAndClassify(self, minimum: float, maximum: float)[source]

Sets min max and classify color tree

Parameters:
  • minimum (float)

  • maximum (float)

setRasterBand(self, band: int)[source]

Sets raster band, only when used for raster layer

Parameters:

band (int)

setRasterDataProvider(self, dp: QgsRasterDataProvider | None)[source]

Associates raster with the widget, only when used for raster layer

Parameters:

dp (Optional[QgsRasterDataProvider])

shader(self) QgsColorRampShader[source]

Returns shared function used in the renderer

Return type:

QgsColorRampShader

signal widgetChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.