Skip to content
Permalink
Browse files

Added method to clear all individual layer settings in QgsSnappingConfig

  • Loading branch information
uclaros authored and nyalldawson committed Sep 26, 2020
1 parent 1387621 commit 9953570e3070288ca265a492d958d61abcd3e2e0
@@ -411,6 +411,13 @@ Returns individual layer snappings settings (applied if mode is AdvancedConfigur
void setIndividualLayerSettings( QgsVectorLayer *vl, const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings );
%Docstring
Sets individual layer snappings settings (applied if mode is AdvancedConfiguration)
%End

void clearIndividualLayerSettings();
%Docstring
Removes all individual layer snapping settings

.. versionadded:: 3.16
%End

bool operator!= ( const QgsSnappingConfig &other ) const;
@@ -797,7 +797,7 @@ QgsPointLocator::Match QgsVertexTool::snapToEditableLayer( QgsMapMouseEvent *e )
config.setEnabled( true );
config.setMode( QgsSnappingConfig::AdvancedConfiguration );
config.setIntersectionSnapping( false ); // only snap to layers
config.individualLayerSettings().clear();
config.clearIndividualLayerSettings();

typedef QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> SettingsHashMap;
SettingsHashMap oldLayerSettings = oldConfig.individualLayerSettings();
@@ -373,6 +373,11 @@ QgsSnappingConfig::IndividualLayerSettings QgsSnappingConfig::individualLayerSet
}
}

void QgsSnappingConfig::clearIndividualLayerSettings()
{
mIndividualLayerSettings.clear();
}

void QgsSnappingConfig::setIndividualLayerSettings( QgsVectorLayer *vl, const IndividualLayerSettings &individualLayerSettings )
{
if ( !vl || !vl->isSpatial() || mIndividualLayerSettings.value( vl ) == individualLayerSettings )
@@ -401,6 +401,13 @@ class CORE_EXPORT QgsSnappingConfig
//! Sets individual layer snappings settings (applied if mode is AdvancedConfiguration)
void setIndividualLayerSettings( QgsVectorLayer *vl, const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings );

/**
* Removes all individual layer snapping settings
*
* \since QGIS 3.16
*/
void clearIndividualLayerSettings();

/**
* Compare this configuration to other.
*/

0 comments on commit 9953570

Please sign in to comment.
You can’t perform that action at this time.