Bug report #20239

Raster layer properties dialog cannot be extended

Added by Ricardo Silva over 1 year ago. Updated over 1 year ago.

Status:Open
Priority:Normal
Assignee:-
Category:Rasters
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

Description

The vector layer properties dialog can be extended by calling QgisInterface.registerMapLayerConfigWidgetFactory()

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 QgsRasterLayerProperties and 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


Related issues

Related to QGIS Application - Bug report #20240: layer properties dialog does not call widget factory's su... Closed 2018-10-27

History

#1 Updated by Ricardo Silva over 1 year ago

  • Related to Bug report #20240: layer properties dialog does not call widget factory's supportsLayer() method added

#2 Updated by Ricardo Silva over 1 year 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?

#3 Updated by Alessandro Pasotti over 1 year ago

Something like QgsMapLayerPropertiesBase makes sense to me, would you like to make a pull request?

#4 Updated by Ricardo Silva over 1 year ago

Yes, I'm willing to submit a PR. I cannot commit to any date for it though. But I hope to be able to submit it soon :)

Also available in: Atom PDF