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¶
Class Hierarchy¶
Base classes¶
Methods
Executes the single band pseudo raster classification |
|
Allows quantile classification mode for raster layers |
|
Loads min and max values from color ramp tree |
|
Gets max value |
|
Gets min value |
|
Populates color ramp tree from ramp items |
|
Sets extent, only when used for raster layer |
|
Sets widget state from the color ramp shader |
|
Sets min max |
|
Sets min max and classify color tree |
|
Sets raster band, only when used for raster layer |
|
Associates raster with the widget, only when used for raster layer |
|
Returns shared function used in the renderer |
Signals
Classification mode changed |
|
Color ramp tree has changed |
|
Widget changed |
- 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(mode: Qgis.ShaderClassificationMethod)[source]¶
Classification mode changed
- Parameters:
- initializeForUseWithRasterLayer(self)[source]¶
Allows quantile classification mode for raster layers
- signal minimumMaximumChangedFromTree(minimum: float, maximum: float)[source]¶
Color ramp tree has changed
- Parameters:
minimum (float)
maximum (float)
- 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: