@@ -216,7 +216,14 @@ void QgsGrassBrowser::copyMap()
216
216
{
217
217
QgsDebugMsg ( " entered." );
218
218
219
- QModelIndexList indexes = mTree ->selectionModel ()->selectedIndexes ();
219
+ // Filter VectorLayer type from selection
220
+ QModelIndexList indexes;
221
+ foreach (QModelIndex index , mTree ->selectionModel ()->selectedIndexes ()){
222
+ int type = mModel ->itemType (index );
223
+ if (type != QgsGrassModel::VectorLayer){
224
+ indexes << index ;
225
+ }
226
+ }
220
227
221
228
QList<QModelIndex>::const_iterator it = indexes.begin ();
222
229
for ( ; it != indexes.end (); ++it )
@@ -288,7 +295,14 @@ void QgsGrassBrowser::renameMap()
288
295
{
289
296
QgsDebugMsg ( " entered." );
290
297
291
- QModelIndexList indexes = mTree ->selectionModel ()->selectedIndexes ();
298
+ // Filter VectorLayer type from selection
299
+ QModelIndexList indexes;
300
+ foreach (QModelIndex index , mTree ->selectionModel ()->selectedIndexes ()){
301
+ int type = mModel ->itemType (index );
302
+ if (type != QgsGrassModel::VectorLayer){
303
+ indexes << index ;
304
+ }
305
+ }
292
306
293
307
QList<QModelIndex>::const_iterator it = indexes.begin ();
294
308
for ( ; it != indexes.end (); ++it )
@@ -352,10 +366,21 @@ void QgsGrassBrowser::deleteMap()
352
366
{
353
367
QgsDebugMsg ( " entered." );
354
368
355
- QModelIndexList indexes = mTree ->selectionModel ()->selectedIndexes ();
369
+ // Filter VectorLayer type from selection
370
+ QModelIndexList indexes;
371
+ foreach (QModelIndex index , mTree ->selectionModel ()->selectedIndexes ()){
372
+ int type = mModel ->itemType (index );
373
+ if (type != QgsGrassModel::VectorLayer){
374
+ indexes << index ;
375
+ }
376
+ }
356
377
357
- if (!QMessageBox::question (this , tr (" Question" ), tr (" Are you sure you want to delete the %1 selected layer(s)?" ).arg (indexes.size ())))
378
+ if (QMessageBox::question (this , tr (" Question" ),
379
+ tr (" Are you sure you want to delete the %1 selected layer(s)?" ).arg (indexes.size ()),
380
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
381
+ {
358
382
return ;
383
+ }
359
384
360
385
QList<QModelIndex>::const_iterator it = indexes.begin ();
361
386
for ( ; it != indexes.end (); ++it )
0 commit comments