@@ -69,8 +69,8 @@ QgsSnappingDialog::QgsSnappingDialog( QWidget* parent, QgsMapCanvas* canvas ): Q
69
69
connect ( mButtonBox , SIGNAL ( accepted () ), this , SLOT ( apply () ) );
70
70
connect ( mButtonBox ->button ( QDialogButtonBox::Apply ), SIGNAL ( clicked () ), this , SLOT ( apply () ) );
71
71
}
72
- connect ( QgsMapLayerRegistry::instance (), SIGNAL ( layerWasAdded ( QgsMapLayer * ) ), this , SLOT ( addLayer ( QgsMapLayer * ) ) );
73
- connect ( QgsMapLayerRegistry::instance (), SIGNAL ( layerWillBeRemoved ( QString ) ), this , SLOT ( layerWillBeRemoved ( QString ) ) );
72
+ connect ( QgsMapLayerRegistry::instance (), SIGNAL ( layersAdded ( QList< QgsMapLayer * > ) ), this , SLOT ( addLayers ( QList< QgsMapLayer * > ) ) );
73
+ connect ( QgsMapLayerRegistry::instance (), SIGNAL ( layersWillBeRemoved ( QStringList ) ), this , SLOT ( layersWillBeRemoved ( QStringList ) ) );
74
74
connect ( cbxEnableTopologicalEditingCheckBox, SIGNAL ( stateChanged ( int ) ), this , SLOT ( on_cbxEnableTopologicalEditingCheckBox_stateChanged ( int ) ) );
75
75
76
76
mLayerTreeWidget ->clear ();
@@ -180,6 +180,14 @@ void QgsSnappingDialog::show()
180
180
QDialog::show ();
181
181
}
182
182
183
+ void QgsSnappingDialog::addLayers ( QList<QgsMapLayer *> layers )
184
+ {
185
+ foreach ( QgsMapLayer* layer, layers )
186
+ {
187
+ addLayer ( layer );
188
+ }
189
+ }
190
+
183
191
void QgsSnappingDialog::addLayer ( QgsMapLayer * theMapLayer )
184
192
{
185
193
QgsVectorLayer *currentVectorLayer = qobject_cast<QgsVectorLayer *>( theMapLayer );
@@ -298,20 +306,23 @@ void QgsSnappingDialog::addLayer( QgsMapLayer * theMapLayer )
298
306
}
299
307
}
300
308
301
- void QgsSnappingDialog::layerWillBeRemoved ( QString theLayerId )
309
+ void QgsSnappingDialog::layersWillBeRemoved ( QStringList thelayers )
302
310
{
303
- QTreeWidgetItem *item = 0 ;
304
-
305
- for ( int i = 0 ; i < mLayerTreeWidget ->topLevelItemCount (); ++i )
311
+ foreach ( QString theLayerId, thelayers )
306
312
{
307
- item = mLayerTreeWidget ->topLevelItem ( i );
308
- if ( item && item->data ( 0 , Qt::UserRole ).toString () == theLayerId )
309
- break ;
310
- item = 0 ;
311
- }
313
+ QTreeWidgetItem *item = 0 ;
314
+
315
+ for ( int i = 0 ; i < mLayerTreeWidget ->topLevelItemCount (); ++i )
316
+ {
317
+ item = mLayerTreeWidget ->topLevelItem ( i );
318
+ if ( item && item->data ( 0 , Qt::UserRole ).toString () == theLayerId )
319
+ break ;
320
+ item = 0 ;
321
+ }
312
322
313
- if ( item )
314
- delete item;
323
+ if ( item )
324
+ delete item;
325
+ }
315
326
}
316
327
317
328
void QgsSnappingDialog::setTopologicalEditingState ()
0 commit comments