Skip to content

Commit 5b5ec8f

Browse files
committed
Handle error fixing on frontend size
1 parent a56062c commit 5b5ec8f

4 files changed

+30
-1
lines changed

src/app/qgsgeometryvalidationdock.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void QgsGeometryValidationDock::setGeometryValidationModel( QgsGeometryValidatio
8383
mErrorListView->setModel( mGeometryValidationModel );
8484

8585
connect( mErrorListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsGeometryValidationDock::onCurrentErrorChanged );
86+
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsRemoved, this, &QgsGeometryValidationDock::updateCurrentError );
8687
}
8788

8889
void QgsGeometryValidationDock::gotoNextError()
@@ -147,6 +148,15 @@ void QgsGeometryValidationDock::setGeometryValidationService( QgsGeometryValidat
147148
mGeometryValidationService = geometryValidationService;
148149
}
149150

151+
void QgsGeometryValidationDock::updateCurrentError()
152+
{
153+
mFeatureRubberband->hide();
154+
mErrorRubberband->hide();
155+
mErrorLocationRubberband->hide();
156+
157+
onCurrentErrorChanged( currentIndex(), QModelIndex() );
158+
}
159+
150160
QModelIndex QgsGeometryValidationDock::currentIndex() const
151161
{
152162
return mErrorListView->selectionModel()->currentIndex();

src/app/qgsgeometryvalidationdock.h

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
4242
void setGeometryValidationService( QgsGeometryValidationService *geometryValidationService );
4343

4444
private slots:
45+
void updateCurrentError();
4546
void onCurrentErrorChanged( const QModelIndex &current, const QModelIndex &previous );
4647
void onCurrentLayerChanged( QgsMapLayer *layer );
4748
void gotoNextError();

src/app/qgsgeometryvalidationmodel.cpp

+18-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ QgsGeometryValidationModel::QgsGeometryValidationModel( QgsGeometryValidationSer
1414
connect( mGeometryValidationService, &QgsGeometryValidationService::geometryCheckStarted, this, &QgsGeometryValidationModel::onGeometryCheckStarted );
1515
connect( mGeometryValidationService, &QgsGeometryValidationService::topologyChecksUpdated, this, &QgsGeometryValidationModel::onTopologyChecksUpdated );
1616
connect( mGeometryValidationService, &QgsGeometryValidationService::topologyChecksCleared, this, &QgsGeometryValidationModel::onTopologyChecksCleared );
17+
connect( mGeometryValidationService, &QgsGeometryValidationService::topologyErrorUpdated, this, &QgsGeometryValidationModel::onTopologyErrorUpdated );
1718
}
1819

1920
QModelIndex QgsGeometryValidationModel::index( int row, int column, const QModelIndex &parent ) const
@@ -76,7 +77,6 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )
7677
{
7778
return tr( "%1: %2" ).arg( featureTitle.toString(), topologyError->description() );
7879
}
79-
8080
}
8181

8282
case FeatureExtentRole:
@@ -328,6 +328,23 @@ void QgsGeometryValidationModel::onTopologyChecksCleared( QgsVectorLayer *layer
328328
}
329329
}
330330

331+
void QgsGeometryValidationModel::onTopologyErrorUpdated( QgsVectorLayer *layer, QgsGeometryCheckError *error )
332+
{
333+
if ( layer == mCurrentLayer )
334+
{
335+
int i = 0;
336+
for ( const auto &currentError : qgis::as_const( mTopologyErrorStorage[layer] ) )
337+
{
338+
if ( currentError.get() == error )
339+
{
340+
QModelIndex idx = index( i, 0, QModelIndex() );
341+
emit dataChanged( idx, idx );
342+
}
343+
++i;
344+
}
345+
}
346+
}
347+
331348
int QgsGeometryValidationModel::errorsForFeature( QgsVectorLayer *layer, QgsFeatureId fid )
332349
{
333350
const auto &layerErrors = mErrorStorage[layer];

src/app/qgsgeometryvalidationmodel.h

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class QgsGeometryValidationModel : public QAbstractItemModel
4343
void onGeometryCheckStarted( QgsVectorLayer *layer, QgsFeatureId fid );
4444
void onTopologyChecksUpdated( QgsVectorLayer *layer, const QList<std::shared_ptr<QgsGeometryCheckError> > &errors );
4545
void onTopologyChecksCleared( QgsVectorLayer *layer );
46+
void onTopologyErrorUpdated( QgsVectorLayer *layer, QgsGeometryCheckError *error );
4647

4748
private:
4849
struct FeatureErrors

0 commit comments

Comments
 (0)