@@ -85,6 +85,7 @@ void QgsGeometryValidationDock::setGeometryValidationModel( QgsGeometryValidatio
85
85
mErrorListView ->setModel ( mGeometryValidationModel );
86
86
87
87
connect ( mErrorListView ->selectionModel (), &QItemSelectionModel::currentChanged, this , &QgsGeometryValidationDock::onCurrentErrorChanged );
88
+ connect ( mGeometryValidationModel , &QgsGeometryValidationModel::dataChanged, this , &QgsGeometryValidationDock::onDataChanged );
88
89
connect ( mGeometryValidationModel , &QgsGeometryValidationModel::rowsRemoved, this , &QgsGeometryValidationDock::updateCurrentError );
89
90
connect ( mGeometryValidationModel , &QgsGeometryValidationModel::rowsInserted, this , &QgsGeometryValidationDock::onRowsInserted );
90
91
}
@@ -141,6 +142,15 @@ void QgsGeometryValidationDock::updateLayerTransform()
141
142
mLayerTransform = QgsCoordinateTransform ( mMapCanvas ->currentLayer ()->crs (), mMapCanvas ->mapSettings ().destinationCrs (), mMapCanvas ->mapSettings ().transformContext () );
142
143
}
143
144
145
+ void QgsGeometryValidationDock::onDataChanged ( const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int > &roles )
146
+ {
147
+ Q_UNUSED ( bottomRight )
148
+ Q_UNUSED ( roles )
149
+
150
+ if ( currentIndex () == topLeft )
151
+ updateCurrentError ();
152
+ }
153
+
144
154
void QgsGeometryValidationDock::onRowsInserted ()
145
155
{
146
156
if ( !isVisible () )
@@ -162,9 +172,15 @@ void QgsGeometryValidationDock::setGeometryValidationService( QgsGeometryValidat
162
172
163
173
void QgsGeometryValidationDock::updateCurrentError ()
164
174
{
175
+ if ( mGeometryValidationModel ->rowCount () == 0 )
176
+ mErrorListView ->selectionModel ()->clearCurrentIndex ();
177
+
165
178
mFeatureRubberband ->hide ();
179
+ mFeatureRubberband ->update ();
166
180
mErrorRubberband ->hide ();
181
+ mErrorRubberband ->update ();
167
182
mErrorLocationRubberband ->hide ();
183
+ mErrorLocationRubberband ->update ();
168
184
169
185
onCurrentErrorChanged ( currentIndex (), QModelIndex () );
170
186
}
@@ -200,31 +216,36 @@ void QgsGeometryValidationDock::onCurrentErrorChanged( const QModelIndex ¤
200
216
delete w;
201
217
202
218
delete mResolutionWidget ->layout ();
203
- const QStringList resolutionMethods = error->check ()->resolutionMethods ();
204
- QGridLayout *layout = new QGridLayout ( mResolutionWidget );
205
- int resolutionIndex = 0 ;
206
- for ( const QString &resolutionMethod : resolutionMethods )
219
+
220
+ if ( error->status () != QgsGeometryCheckError::StatusFixed )
207
221
{
208
- QToolButton *resolveBtn = new QToolButton ( mResolutionWidget );
209
- resolveBtn->setIcon ( QgsApplication::getThemeIcon ( QStringLiteral ( " /algorithms/mAlgorithmCheckGeometry.svg" ) ) );
210
- layout->addWidget ( resolveBtn, resolutionIndex, 0 );
211
- QLabel *resolveLabel = new QLabel ( resolutionMethod, mResolutionWidget );
212
- resolveLabel->setWordWrap ( true );
213
- layout->addWidget ( resolveLabel, resolutionIndex, 1 );
214
- connect ( resolveBtn, &QToolButton::clicked, this , [resolutionIndex, error, this ]()
222
+ const QStringList resolutionMethods = error->check ()->resolutionMethods ();
223
+ QGridLayout *layout = new QGridLayout ( mResolutionWidget );
224
+ int resolutionIndex = 0 ;
225
+ for ( const QString &resolutionMethod : resolutionMethods )
215
226
{
216
- mGeometryValidationService ->fixError ( error, resolutionIndex );
217
- } );
218
- resolutionIndex++;
227
+ QToolButton *resolveBtn = new QToolButton ( mResolutionWidget );
228
+ resolveBtn->setIcon ( QgsApplication::getThemeIcon ( QStringLiteral ( " /algorithms/mAlgorithmCheckGeometry.svg" ) ) );
229
+ layout->addWidget ( resolveBtn, resolutionIndex, 0 );
230
+ QLabel *resolveLabel = new QLabel ( resolutionMethod, mResolutionWidget );
231
+ resolveLabel->setWordWrap ( true );
232
+ layout->addWidget ( resolveLabel, resolutionIndex, 1 );
233
+ connect ( resolveBtn, &QToolButton::clicked, this , [resolutionIndex, error, this ]()
234
+ {
235
+ mGeometryValidationService ->fixError ( error, resolutionIndex );
236
+ } );
237
+ resolutionIndex++;
238
+ }
239
+
240
+ mResolutionWidget ->setLayout ( layout );
241
+
242
+ showHighlight ( current );
219
243
}
220
- mResolutionWidget ->setLayout ( layout );
221
244
}
222
245
223
246
bool hasFeature = !FID_IS_NULL ( current.data ( QgsGeometryValidationModel::ErrorFeatureIdRole ) );
224
247
mZoomToFeatureButton ->setEnabled ( hasFeature );
225
248
226
- showHighlight ( current );
227
-
228
249
switch ( mLastZoomToAction )
229
250
{
230
251
case ZoomToProblem:
0 commit comments