Bug report #20239
Raster layer properties dialog cannot be extended
|Affected QGIS version:||3.3(master)||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||28060|
The vector layer properties dialog can be extended by calling
Plugin authors can create a class that derives from
QgsMapLayerConfigWidgetFactory and implements its virtual methods, especially
createWidget() and this allows adding custom panels to the Vector layer properties dialog.
Unfortunately it is not possible to extend the Raster layer properties dialog in this way, which kind of feels more like a bug than a missing feature.
Looking at QGIS' source code, both
QgsVectorLayerProperties inherit from
QgsOptionsDialogBase, so it seems like moving the code that is currently present in the vector layer properties to the base class would fix this. The relevant method is
QgsVectorLayerProperties::addPropertiesPageFactory(). This method is only called in
QgisApp::showLayerProperties() - currently it is only called for vector layers, but it would be possible to call it also with raster layers
#2 Updated by Ricardo Silva about 2 years ago
Upon closer inspection, it seems
QgsOptionsDialogBase is very generic and is used in lots of places, so this kind of functionality does not seem like it belongs there. Perhaps a new class that derives from
QgsOptionDialogBase and is a base for both layer properties dialogs is in order?