@@ -852,10 +852,10 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
852
852
853
853
// default snap mode
854
854
mSnappingEnabledDefault ->setChecked ( mSettings ->value ( QStringLiteral ( " /qgis/digitizing/default_snap_enabled" ), false ).toBool () );
855
- mDefaultSnapModeComboBox ->insertItem ( 0 , tr ( " Vertex" ), QgsSnappingConfig::Vertex );
856
- mDefaultSnapModeComboBox ->insertItem ( 1 , tr ( " Vertex and segment" ), QgsSnappingConfig::VertexAndSegment );
857
- mDefaultSnapModeComboBox ->insertItem ( 2 , tr ( " Segment" ), QgsSnappingConfig::Segment );
858
- mDefaultSnapModeComboBox ->setCurrentIndex ( mSettings ->value ( QStringLiteral ( " /qgis/digitizing/default_snap_type" ), QgsSnappingConfig::Vertex ).toInt () - 1 );
855
+ mDefaultSnapModeComboBox ->addItem ( tr ( " Vertex" ), QgsSnappingConfig::Vertex );
856
+ mDefaultSnapModeComboBox ->addItem ( tr ( " Vertex and segment" ), QgsSnappingConfig::VertexAndSegment );
857
+ mDefaultSnapModeComboBox ->addItem ( tr ( " Segment" ), QgsSnappingConfig::Segment );
858
+ mDefaultSnapModeComboBox ->setCurrentIndex ( mDefaultSnapModeComboBox -> findData ( mSettings ->value ( QStringLiteral ( " /qgis/digitizing/default_snap_type" ), QgsSnappingConfig::Vertex ).toInt () ) );
859
859
mDefaultSnappingToleranceSpinBox ->setValue ( mSettings ->value ( QStringLiteral ( " /qgis/digitizing/default_snapping_tolerance" ), 0 ).toDouble () );
860
860
mSearchRadiusVertexEditSpinBox ->setValue ( mSettings ->value ( QStringLiteral ( " /qgis/digitizing/search_radius_vertex_edit" ), 10 ).toDouble () );
861
861
int defSnapUnits = mSettings ->value ( QStringLiteral ( " /qgis/digitizing/default_snapping_tolerance_unit" ), QgsTolerance::ProjectUnits ).toInt ();
@@ -1359,8 +1359,7 @@ void QgsOptions::saveOptions()
1359
1359
1360
1360
// default snap mode
1361
1361
mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/default_snap_enabled" ), mSnappingEnabledDefault ->isChecked () );
1362
- int defaultSnapModeString = mDefaultSnapModeComboBox ->currentData ().toInt ();
1363
- mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/default_snap_type" ), defaultSnapModeString );
1362
+ mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/default_snap_type" ), mDefaultSnapModeComboBox ->currentData ().toInt () );
1364
1363
mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/default_snapping_tolerance" ), mDefaultSnappingToleranceSpinBox ->value () );
1365
1364
mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/search_radius_vertex_edit" ), mSearchRadiusVertexEditSpinBox ->value () );
1366
1365
mSettings ->setValue ( QStringLiteral ( " /qgis/digitizing/default_snapping_tolerance_unit" ),
0 commit comments