Skip to content

Commit 6d54e87

Browse files
author
mhugent
committed
Improvements for merge tool. Show a progress dialog during the merge and make the item showing the attribute values after the merge editable
git-svn-id: http://svn.osgeo.org/qgis/trunk@10943 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3999172 commit 6d54e87

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/app/qgisapp.cpp

+17-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include <QPrinter>
5454
#include <QProcess>
5555
#include <QProgressBar>
56+
#include <QProgressDialog>
5657
#include <QRegExp>
5758
#include <QRegExpValidator>
5859
#include <QSettings>
@@ -4139,7 +4140,7 @@ void QgisApp::deletePart()
41394140
mMapCanvas->setMapTool( mMapTools.mDeletePart );
41404141
}
41414142

4142-
QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList) const
4143+
QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList)
41434144
{
41444145
if(!vl || featureList.size() < 2)
41454146
{
@@ -4153,8 +4154,20 @@ QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList&
41534154
return 0;
41544155
}
41554156

4157+
QProgressDialog progress(tr("Merging features..."), tr("Abort"), 0, featureList.size(), this);
4158+
progress.setWindowModality(Qt::WindowModal);
4159+
4160+
QApplication::setOverrideCursor( Qt::WaitCursor );
4161+
41564162
for(int i = 1; i < featureList.size(); ++i)
41574163
{
4164+
if(progress.wasCanceled())
4165+
{
4166+
delete unionGeom;
4167+
QApplication::restoreOverrideCursor();
4168+
return 0;
4169+
}
4170+
progress.setValue(i);
41584171
QgsGeometry* currentGeom = featureList[i].geometry();
41594172
if(currentGeom)
41604173
{
@@ -4167,6 +4180,9 @@ QgsGeometry* QgisApp::unionGeometries(const QgsVectorLayer* vl, QgsFeatureList&
41674180
}
41684181
}
41694182
}
4183+
4184+
QApplication::restoreOverrideCursor();
4185+
progress.setValue(featureList.size());
41704186
return unionGeom;
41714187
}
41724188

src/app/qgisapp.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ class QgisApp : public QMainWindow
667667
bool saveDirty();
668668
/** Helper function to union several geometries together (used in function mergeSelectedFeatures)
669669
@return 0 in case of error*/
670-
QgsGeometry* unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList) const;
670+
QgsGeometry* unionGeometries(const QgsVectorLayer* vl, QgsFeatureList& featureList);
671671

672672
/// QgisApp aren't copyable
673673
QgisApp( QgisApp const & );

src/app/qgsmergeattributesdialog.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void QgsMergeAttributesDialog::refreshMergedValue(int col)
248248

249249
//insert string into table widget
250250
QTableWidgetItem* newTotalItem = new QTableWidgetItem(evalText);
251-
newTotalItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
251+
newTotalItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable);
252252
mTableWidget->setItem(mTableWidget->rowCount() - 1, col, newTotalItem);
253253
}
254254

0 commit comments

Comments
 (0)