QgsColorRampShaderWidget class

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)

Constructors, destructors, conversion operators

QgsColorRampShaderWidget(QWidget* parent = nullptr)
Creates new color ramp shader widget.

Public functions

void initializeForUseWithRasterLayer()
Allows quantile classification mode for raster layers.
auto maximum() const -> double
Gets max value.
auto minimum() const -> double
Gets min value.
void setExtent(const QgsRectangle& extent)
Sets extent, only when used for raster layer.
void setFromShader(const QgsColorRampShader& colorRampShader)
Sets widget state from the color ramp shader.
void setMinimumMaximum(double minimum, double maximum)
Sets min max.
void setMinimumMaximumAndClassify(double minimum, double maximum)
Sets min max and classify color tree.
void setRasterBand(int band)
Sets raster band, only when used for raster layer.
void setRasterDataProvider(QgsRasterDataProvider* dp)
Associates raster with the widget, only when used for raster layer.
auto shader() const -> QgsColorRampShader
Returns shared function used in the renderer.

Signals

void classificationModeChanged(QgsColorRampShader::ClassificationMode mode)
Classification mode changed.
void minimumMaximumChangedFromTree(double minimum, double maximum)
Color ramp tree has changed.
void widgetChanged()
Widget changed.

Public slots

void classify()
Executes the single band pseudo raster classification.
void loadMinimumMaximumFromTree()
Loads min and max values from color ramp tree.

Protected functions

void populateColormapTreeWidget(const QList<QgsColorRampShader::ColorRampItem>& colorRampItems)
Populates color ramp tree from ramp items.