@@ -247,16 +247,30 @@ void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)
247
247
{
248
248
for (i = 0 ; i < layerCount (); i++)
249
249
{
250
- disconnect (getZpos (i), SIGNAL (repaintRequested ()), this , SLOT (refresh ()));
251
- disconnect (getZpos (i), SIGNAL (selectionChanged ()), this , SLOT (refresh ()));
250
+ // Add check if vector layer when disconnecting from selectionChanged slot
251
+ // Ticket #811 - racicot
252
+ QgsMapLayer *currentLayer = getZpos (i);
253
+ disconnect (currentLayer, SIGNAL (repaintRequested ()), this , SLOT (refresh ()));
254
+ QgsVectorLayer *isVectLyr = dynamic_cast < QgsVectorLayer * >(currentLayer);
255
+ if (isVectLyr)
256
+ {
257
+ disconnect (currentLayer, SIGNAL (selectionChanged ()), this , SLOT (refresh ()));
258
+ }
252
259
}
253
260
254
261
mMapRender ->setLayerSet (layerSet);
255
262
256
263
for (i = 0 ; i < layerCount (); i++)
257
264
{
258
- connect (getZpos (i), SIGNAL (repaintRequested ()), this , SLOT (refresh ()));
259
- connect (getZpos (i), SIGNAL (selectionChanged ()), this , SLOT (refresh ()));
265
+ // Add check if vector layer when connecting to selectionChanged slot
266
+ // Ticket #811 - racicot
267
+ QgsMapLayer *currentLayer = getZpos (i);
268
+ connect (currentLayer, SIGNAL (repaintRequested ()), this , SLOT (refresh ()));
269
+ QgsVectorLayer *isVectLyr = dynamic_cast < QgsVectorLayer * >(currentLayer);
270
+ if (isVectLyr)
271
+ {
272
+ connect (currentLayer, SIGNAL (selectionChanged ()), this , SLOT (refresh ()));
273
+ }
260
274
}
261
275
}
262
276
0 commit comments