[QGIS Commit] r11203 - trunk/qgis/src/plugins/grass
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Wed Jul 29 10:05:17 EDT 2009
Author: rugginoso
Date: 2009-07-29 10:05:16 -0400 (Wed, 29 Jul 2009)
New Revision: 11203
Modified:
trunk/qgis/src/plugins/grass/qgsgrassbrowser.cpp
Log:
Fixed a crash when a QgsGrassModel::VectorLayer contained into a multiple selection is deleted, renamed or copied.
Modified: trunk/qgis/src/plugins/grass/qgsgrassbrowser.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassbrowser.cpp 2009-07-29 13:22:36 UTC (rev 11202)
+++ trunk/qgis/src/plugins/grass/qgsgrassbrowser.cpp 2009-07-29 14:05:16 UTC (rev 11203)
@@ -216,7 +216,14 @@
{
QgsDebugMsg( "entered." );
- QModelIndexList indexes = mTree->selectionModel()->selectedIndexes();
+ // Filter VectorLayer type from selection
+ QModelIndexList indexes;
+ foreach(QModelIndex index, mTree->selectionModel()->selectedIndexes()){
+ int type = mModel->itemType(index);
+ if (type != QgsGrassModel::VectorLayer){
+ indexes << index;
+ }
+ }
QList<QModelIndex>::const_iterator it = indexes.begin();
for ( ; it != indexes.end(); ++it )
@@ -288,7 +295,14 @@
{
QgsDebugMsg( "entered." );
- QModelIndexList indexes = mTree->selectionModel()->selectedIndexes();
+ // Filter VectorLayer type from selection
+ QModelIndexList indexes;
+ foreach(QModelIndex index, mTree->selectionModel()->selectedIndexes()){
+ int type = mModel->itemType(index);
+ if (type != QgsGrassModel::VectorLayer){
+ indexes << index;
+ }
+ }
QList<QModelIndex>::const_iterator it = indexes.begin();
for ( ; it != indexes.end(); ++it )
@@ -352,10 +366,21 @@
{
QgsDebugMsg( "entered." );
- QModelIndexList indexes = mTree->selectionModel()->selectedIndexes();
+ // Filter VectorLayer type from selection
+ QModelIndexList indexes;
+ foreach(QModelIndex index, mTree->selectionModel()->selectedIndexes()){
+ int type = mModel->itemType(index);
+ if (type != QgsGrassModel::VectorLayer){
+ indexes << index;
+ }
+ }
- if (!QMessageBox::question(this, tr("Question"), tr("Are you sure you want to delete the %1 selected layer(s)?").arg(indexes.size())))
+ if (QMessageBox::question(this, tr("Question"),
+ tr("Are you sure you want to delete the %1 selected layer(s)?").arg(indexes.size()),
+ QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
+ {
return;
+ }
QList<QModelIndex>::const_iterator it = indexes.begin();
for ( ; it != indexes.end(); ++it )
More information about the QGIS-commit
mailing list