Using the toolbar GUI of QGIS (Currenly using v3.28), I can enabled multiple/all the snapping types like this:
Now that's exactly what I'm trying to do in this code: (Just setting 2 types for the example)
snapping_config = QgsSnappingConfig()
snapping_config.setEnabled(True)
snapping_config.setMode(QgsSnappingConfig.AllLayers)
# This only enables Area Snapping
snapping_config.setTypeFlag(QgsSnappingConfig.AreaFlag)
# Using the same method again with different type, only overwrites the previously set type.
snapping_config.setTypeFlag(QgsSnappingConfig.CentroidFlag)
QgsProject.instance().setSnappingConfig(snapping_config)
But I can't figure it out since the setTypeFlag
method only accepts only one SnappingType
enum object.
https://github.com/qgis/QGIS/blob/release-3_38/src/core/qgssnappingconfig.h#L255
How can I do that in QGIS python?