Navigation Menu

Skip to content

Commit

Permalink
fix updating table selection
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Feb 25, 2019
1 parent 1b14524 commit 06f92d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/app/vertextool/qgsvertexeditor.cpp
Expand Up @@ -346,7 +346,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
{
Expand All @@ -373,9 +373,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 );
Expand Down
9 changes: 6 additions & 3 deletions src/app/vertextool/qgsvertextool.cpp
Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit 06f92d2

Please sign in to comment.