[QGIS Commit] r10943 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jun 17 10:23:30 EDT 2009


Author: mhugent
Date: 2009-06-17 10:23:29 -0400 (Wed, 17 Jun 2009)
New Revision: 10943

Modified:
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgisapp.h
   trunk/qgis/src/app/qgsmergeattributesdialog.cpp
Log:
Improvements for merge tool. Show a progress dialog during the merge and make the item showing the attribute values after the merge editable

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2009-06-17 12:45:51 UTC (rev 10942)
+++ trunk/qgis/src/app/qgisapp.cpp	2009-06-17 14:23:29 UTC (rev 10943)
@@ -53,6 +53,7 @@
 #include <QPrinter>
 #include <QProcess>
 #include <QProgressBar>
+#include <QProgressDialog>
 #include <QRegExp>
 #include <QRegExpValidator>
 #include <QSettings>
@@ -4139,7 +4140,7 @@
   mMapCanvas->setMapTool( mMapTools.mDeletePart );
 }
 
-QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList) const
+QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList)
 {
   if(!vl || featureList.size() < 2)
   {
@@ -4153,8 +4154,20 @@
     return 0;
   }
 
+  QProgressDialog progress(tr("Merging features..."), tr("Abort"), 0, featureList.size(), this);
+  progress.setWindowModality(Qt::WindowModal);
+
+  QApplication::setOverrideCursor( Qt::WaitCursor );
+
   for(int i = 1; i < featureList.size(); ++i)
   {
+    if(progress.wasCanceled())
+    {
+      delete unionGeom;
+      QApplication::restoreOverrideCursor();
+      return 0;
+    }
+    progress.setValue(i);
     QgsGeometry* currentGeom = featureList[i].geometry();
     if(currentGeom)
     {
@@ -4167,6 +4180,9 @@
       }
     }
   }
+
+  QApplication::restoreOverrideCursor();
+  progress.setValue(featureList.size());
   return unionGeom;
 }
 

Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h	2009-06-17 12:45:51 UTC (rev 10942)
+++ trunk/qgis/src/app/qgisapp.h	2009-06-17 14:23:29 UTC (rev 10943)
@@ -667,7 +667,7 @@
     bool saveDirty();
     /** Helper function to union several geometries together (used in function mergeSelectedFeatures)
       @return 0 in case of error*/
-    QgsGeometry* unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList) const;
+    QgsGeometry* unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList);
 
     /// QgisApp aren't copyable
     QgisApp( QgisApp const & );

Modified: trunk/qgis/src/app/qgsmergeattributesdialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsmergeattributesdialog.cpp	2009-06-17 12:45:51 UTC (rev 10942)
+++ trunk/qgis/src/app/qgsmergeattributesdialog.cpp	2009-06-17 14:23:29 UTC (rev 10943)
@@ -248,7 +248,7 @@
 
     //insert string into table widget
    QTableWidgetItem* newTotalItem = new QTableWidgetItem(evalText);
-   newTotalItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
+   newTotalItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
    mTableWidget->setItem(mTableWidget->rowCount() - 1, col, newTotalItem);
 }
 



More information about the QGIS-commit mailing list