2020#include " qgsmapcanvas.h"
2121#include " qgsmessagelog.h"
2222#include " qgslockedfeature.h"
23- #include " qgsvertexentry.h"
2423#include " qgsvectorlayer.h"
2524#include " qgsgeometryutils.h"
2625#include " qgsproject.h"
@@ -379,7 +378,7 @@ void QgsVertexEditor::updateEditor( QgsLockedFeature *lockedFeature )
379378
380379void QgsVertexEditor::updateTableSelection ()
381380{
382- if ( !mLockedFeature || mUpdatingVertexSelection )
381+ if ( !mLockedFeature || mUpdatingVertexSelection || mUpdatingTableSelection )
383382 return ;
384383
385384 mUpdatingTableSelection = true ;
@@ -395,11 +394,7 @@ void QgsVertexEditor::updateTableSelection()
395394 selection.select ( mVertexModel ->index ( i, 0 ), mVertexModel ->index ( i, mVertexModel ->columnCount () - 1 ) );
396395 }
397396 }
398- disconnect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
399- disconnect ( mTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , &QgsVertexEditor::updateVertexSelection );
400397 mTableView ->selectionModel ()->select ( selection, QItemSelectionModel::ClearAndSelect );
401- connect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
402- connect ( mTableView ->selectionModel (), &QItemSelectionModel::selectionChanged, this , &QgsVertexEditor::updateVertexSelection );
403398
404399 if ( firstSelectedRow >= 0 )
405400 mTableView ->scrollTo ( mVertexModel ->index ( firstSelectedRow, 0 ), QAbstractItemView::PositionAtTop );
@@ -409,11 +404,10 @@ void QgsVertexEditor::updateTableSelection()
409404
410405void QgsVertexEditor::updateVertexSelection ( const QItemSelection &, const QItemSelection & )
411406{
412- if ( !mLockedFeature || mUpdatingTableSelection )
407+ if ( !mLockedFeature || mUpdatingVertexSelection || mUpdatingTableSelection )
413408 return ;
414409
415410 mUpdatingVertexSelection = true ;
416- disconnect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
417411
418412 mLockedFeature ->deselectAllVertices ();
419413
@@ -450,7 +444,6 @@ void QgsVertexEditor::updateVertexSelection( const QItemSelection &, const QItem
450444 }
451445
452446 mUpdatingVertexSelection = false ;
453- connect ( mLockedFeature , &QgsLockedFeature::selectionChanged, this , &QgsVertexEditor::updateTableSelection );
454447}
455448
456449void QgsVertexEditor::keyPressEvent ( QKeyEvent *e )
@@ -504,3 +497,5 @@ void CoordinateItemDelegate::setModelData( QWidget *editor, QAbstractItemModel *
504497 QStyledItemDelegate::setModelData ( editor, model, index );
505498 }
506499}
500+
501+
0 commit comments