Skip to content

Commit

Permalink
Update Attr Table after field calculation: fixes #17312
Browse files Browse the repository at this point in the history
  • Loading branch information
luipir authored and m-kuhn committed Oct 31, 2017
1 parent 5f750e7 commit 192d6f9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -533,10 +533,17 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer *layer, const
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error occurred while evaluating the calculation string:\n%1" ).arg( error ) );
mLayer->destroyEditCommand();
return;
}
else
{
mLayer->endEditCommand();

mLayer->endEditCommand();
// refresh table with updated values
// fixes https://issues.qgis.org/issues/17312
QgsAttributeTableModel *masterModel = mMainView->masterModel();
int modelColumn = masterModel->fieldCol( fieldindex );
masterModel->reload( masterModel->index( 0, modelColumn ), masterModel->index( masterModel->rowCount() - 1, modelColumn ) );
}
}

void QgsAttributeTableDialog::replaceSearchWidget( QWidget *oldw, QWidget *neww )
Expand Down

0 comments on commit 192d6f9

Please sign in to comment.