I know that for QgsVectorLayer, there is the QgsSymbolV2SelectorDialog dialog that I can call to allow users to change vector layer's styles. I am looking for an equivalent dialog for QgsRasterLayer. I found a QgsRasterRendererWidget and I put it in a QDialog, but when I instantiate it like:

layer = QgsRasterLayer() editor = QgsRasterRendererWidget(layer, layer.extent())

it gave the following exception:

TypeError: qgis._gui.QgsRasterRendererWidget represents a C++ abstract class and cannot be instantiated

So, is there a dialog class that I can use to open the raster property dialog to allow users to change raster render style?

1 Answer 1


For raster layer, use QgsSingleBandPseudoColorRendererWidget and QgsMultiBandColorRendererWidget

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.