@@ -374,30 +374,33 @@ void QgsVertexEditor::updateTableSelection()
374
374
}
375
375
}
376
376
disconnect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
377
+ disconnect ( mTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , &QgsVertexEditor::updateVertexSelection );
377
378
mTableView ->selectionModel ()->select ( selection, QItemSelectionModel::ClearAndSelect );
378
379
connect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
380
+ connect ( mTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , &QgsVertexEditor::updateVertexSelection );
379
381
380
382
if ( firstSelectedRow >= 0 )
381
383
mTableView ->scrollTo ( mVertexModel ->index ( firstSelectedRow, 0 ), QAbstractItemView::PositionAtTop );
382
384
383
385
mUpdatingTableSelection = false ;
384
386
}
385
387
386
- void QgsVertexEditor::updateVertexSelection ( const QItemSelection &selected , const QItemSelection & )
388
+ void QgsVertexEditor::updateVertexSelection ( const QItemSelection &, const QItemSelection & )
387
389
{
388
390
if ( !mLockedFeature || mUpdatingTableSelection )
389
391
return ;
390
392
391
393
mUpdatingVertexSelection = true ;
394
+ disconnect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
392
395
393
396
mLockedFeature ->deselectAllVertices ();
394
397
395
398
QgsCoordinateTransform t ( mLockedFeature ->layer ()->crs (), mCanvas ->mapSettings ().destinationCrs (), QgsProject::instance () );
396
399
std::unique_ptr<QgsRectangle> bbox;
397
- QModelIndexList indexList = selected. indexes ();
398
- for ( int i = 0 ; i < indexList. length (); ++i )
400
+ const QModelIndexList indexList = mTableView -> selectionModel ()-> selectedRows ();
401
+ for ( const QModelIndex &index : indexList )
399
402
{
400
- int vertexIdx = indexList. at ( i ) .row ();
403
+ int vertexIdx = index .row ();
401
404
mLockedFeature ->selectVertex ( vertexIdx );
402
405
403
406
// create a bounding box of selected vertices
@@ -425,6 +428,7 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
425
428
}
426
429
427
430
mUpdatingVertexSelection = false ;
431
+ connect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
428
432
}
429
433
430
434
void QgsVertexEditor::keyPressEvent ( QKeyEvent *e )
0 commit comments