Skip to content
Permalink
Browse files

fix updating table selection

  • Loading branch information
3nids committed Feb 22, 2019
1 parent f7ef54e commit e8e225804913a25b7efd170bef325e39f0a0f2f4
Showing with 9 additions and 6 deletions.
  1. +3 −3 src/app/vertextool/qgsvertexeditor.cpp
  2. +6 −3 src/app/vertextool/qgsvertextool.cpp
@@ -368,7 +368,7 @@ void QgsVertexEditor::updateEditor( QgsLockedFeature *lockedFeature )
mHintLabel->setVisible( false );
mTableView->setVisible( true );

//connect( mLockedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
connect( mLockedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
}
else
{
@@ -395,9 +395,9 @@ void QgsVertexEditor::updateTableSelection()
selection.select( mVertexModel->index( i, 0 ), mVertexModel->index( i, mVertexModel->columnCount() - 1 ) );
}
}
//disconnect( mLockedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
disconnect( mLockedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
mTableView->selectionModel()->select( selection, QItemSelectionModel::ClearAndSelect );
//connect( mLockedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );
connect( mLockedFeature, &QgsLockedFeature::selectionChanged, this, &QgsVertexEditor::updateTableSelection );

if ( firstSelectedRow >= 0 )
mTableView->scrollTo( mVertexModel->index( firstSelectedRow, 0 ), QAbstractItemView::PositionAtTop );
@@ -2319,16 +2319,19 @@ void QgsVertexTool::setHighlightedVertices( const QList<Vertex> &listVertices, H
if ( mLockedFeature )
{
disconnect( mLockedFeature.get(), &QgsLockedFeature::selectionChanged, this, &QgsVertexTool::lockedFeatureSelectionChanged );

mLockedFeature->deselectAllVertices();
for ( const Vertex &vertex : qgis::as_const( mSelectedVertices ) )
{
// we should never be able to select vertices that are not from the locked feature
Q_ASSERT( mLockedFeature->featureId() == vertex.fid && mLockedFeature->layer() == vertex.layer );
mLockedFeature->selectVertex( vertex.vertexId );
}
connect( mLockedFeature.get(), &QgsLockedFeature::selectionChanged, this, &QgsVertexTool::lockedFeatureSelectionChanged );

if ( mVertexEditor )
mVertexEditor->updateTableSelection();
// if ( mVertexEditor )
// mVertexEditor->updateTableSelection();

connect( mLockedFeature.get(), &QgsLockedFeature::selectionChanged, this, &QgsVertexTool::lockedFeatureSelectionChanged );
}
}

0 comments on commit e8e2258

Please sign in to comment.
You can’t perform that action at this time.