@@ -121,10 +121,11 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
121
121
}
122
122
123
123
bool ok;
124
+ bool toleranceUnitOk; // 1.0 project files may not have a unit entry
124
125
QStringList layerIdList = QgsProject::instance ()->readListEntry ( " Digitizing" , " /LayerSnappingList" , &ok );
125
126
QStringList enabledList = QgsProject::instance ()->readListEntry ( " Digitizing" , " /LayerSnappingEnabledList" , &ok );
126
127
QStringList toleranceList = QgsProject::instance ()->readListEntry ( " Digitizing" , " /LayerSnappingToleranceList" , &ok );
127
- QStringList toleranceUnitList = QgsProject::instance ()->readListEntry ( " Digitizing" , " /LayerSnappingToleranceUnitList" , &ok );
128
+ QStringList toleranceUnitList = QgsProject::instance ()->readListEntry ( " Digitizing" , " /LayerSnappingToleranceUnitList" , &toleranceUnitOk );
128
129
QStringList snapToList = QgsProject::instance ()->readListEntry ( " Digitizing" , " /LayerSnapToList" , &ok );
129
130
130
131
QStringList::const_iterator idIter = layerIdList.constBegin ();
@@ -136,7 +137,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
136
137
QgsMapLayer* currentLayer = 0 ;
137
138
138
139
// create the new layer entries
139
- for ( ; idIter != layerIdList.constEnd (); ++idIter, ++enabledIter, ++tolIter, ++snapToIter )
140
+ for ( ; idIter != layerIdList.constEnd (); ++idIter, ++enabledIter, ++tolIter, ++tolUnitIter, ++ snapToIter )
140
141
{
141
142
currentLayer = QgsMapLayerRegistry::instance ()->mapLayer ( *idIter );
142
143
if ( currentLayer )
@@ -164,7 +165,14 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
164
165
newEntry.snapTo = 2 ;
165
166
}
166
167
newEntry.tolerance = tolIter->toDouble ();
167
- newEntry.toleranceUnit = tolUnitIter->toInt ();
168
+ if (toleranceUnitOk)
169
+ {
170
+ newEntry.toleranceUnit = tolUnitIter->toInt ();
171
+ }
172
+ else
173
+ {
174
+ newEntry.toleranceUnit = 0 ;
175
+ }
168
176
mSnappingLayerSettings .insert ( *idIter, newEntry );
169
177
}
170
178
}
0 commit comments