@@ -396,30 +396,33 @@ void QgsVertexEditor::updateTableSelection()
396
396
}
397
397
}
398
398
disconnect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
399
+ disconnect ( mTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , &QgsVertexEditor::updateVertexSelection );
399
400
mTableView ->selectionModel ()->select ( selection, QItemSelectionModel::ClearAndSelect );
400
401
connect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
402
+ connect ( mTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , &QgsVertexEditor::updateVertexSelection );
401
403
402
404
if ( firstSelectedRow >= 0 )
403
405
mTableView ->scrollTo ( mVertexModel ->index ( firstSelectedRow, 0 ), QAbstractItemView::PositionAtTop );
404
406
405
407
mUpdatingTableSelection = false ;
406
408
}
407
409
408
- void QgsVertexEditor::updateVertexSelection ( const QItemSelection &selected , const QItemSelection & )
410
+ void QgsVertexEditor::updateVertexSelection ( const QItemSelection &, const QItemSelection & )
409
411
{
410
412
if ( !mLockedFeature || mUpdatingTableSelection )
411
413
return ;
412
414
413
415
mUpdatingVertexSelection = true ;
416
+ disconnect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
414
417
415
418
mLockedFeature ->deselectAllVertices ();
416
419
417
420
QgsCoordinateTransform t ( mLockedFeature ->layer ()->crs (), mCanvas ->mapSettings ().destinationCrs (), QgsProject::instance () );
418
421
std::unique_ptr<QgsRectangle> bbox;
419
- QModelIndexList indexList = selected. indexes ();
420
- for ( int i = 0 ; i < indexList. length (); ++i )
422
+ const QModelIndexList indexList = mTableView -> selectionModel ()-> selectedRows ();
423
+ for ( const QModelIndex & index : indexList )
421
424
{
422
- int vertexIdx = indexList. at ( i ) .row ();
425
+ int vertexIdx = index .row ();
423
426
mLockedFeature ->selectVertex ( vertexIdx );
424
427
425
428
// create a bounding box of selected vertices
@@ -447,6 +450,7 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &selected, con
447
450
}
448
451
449
452
mUpdatingVertexSelection = false ;
453
+ connect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
450
454
}
451
455
452
456
void QgsVertexEditor::keyPressEvent ( QKeyEvent *e )
0 commit comments