[QGIS-Developer] replacement of QgsMapLayer::LayerType by QgsMapLayerType

Denis Rouzaud denis.rouzaud at gmail.com
Mon Mar 25 09:12:34 PDT 2019


Dear list,

A small warning that I am about to merge PR #9437
https://github.com/qgis/QGIS/pull/9437

This pull request adds a new scope based enum for map layer types.
In other words, QgsMapLayer::LayerType is now QgsMapLayerType.

This change has been motivated by:
- scope based enums are nicely displayed in the PyQGIS docs (see
https://qgis.org/pyqgis/master/gui/QgsAdvancedDigitizingDockWidget.html#qgis.gui.QgsAdvancedDigitizingDockWidget.AdditionalConstraint
 )
- taking the enum outside of the QgsMapLayer class:
  * allows to use forward declarations of the enum (and not including the
whole qgsmaplayer.h file)
  * avoid the rather long call: QgsMapLayer::LayerType::VectorLayer
(mandatory with scope based enums)

This means that current "green" pull request **might** actually need a
rebase and retest.

Regarding Python API compatibility, it is kept by using monkey patching. So
no worries on this side.

This follows a former merged PR that introduced a scope based enum, but
this one was kept in class
https://github.com/qgis/QGIS/pull/9425

So, basically to be nicely displayed in the PyQGIS API docs, all enums
shall be converted to scope based enums. Then, deciding to take them out of
class or not depends a bit if the enum is meant to be mainly used within
the class or not.

Thanks for reading, best wishes
And have a good rebase :)

Denis


-- 

Denis Rouzaud
denis at opengis.ch  <denis at opengis.ch>
+41 76 370 21 22
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190325/f4bde9e4/attachment-0001.html>


More information about the QGIS-Developer mailing list