Skip to content
Permalink
Browse files

Fix #17412 Sorting fixed, no troubles when editing after sorting

Issue was, that the cellchange is triggered at re-sorting or renaming something in re-sorted table - so there was a bug that referenced to the row instead of the index
  • Loading branch information
signedav authored and m-kuhn committed Nov 8, 2017
1 parent 3780223 commit 93396153bb6c427f4d48e167049f5f3b4e7ab058
Showing with 5 additions and 3 deletions.
  1. +5 −3 src/app/qgsfieldsproperties.cpp
@@ -776,15 +776,17 @@ void QgsFieldsProperties::attributesListCellChanged( int row, int column )
}
else if ( column == attrNameCol && mLayer && mLayer->isEditable() )
{
int idx = mIndexedWidgets.indexOf( mFieldsList->item( row, attrIdCol ) );

QTableWidgetItem *nameItem = mFieldsList->item( row, column );
if ( !nameItem ||
nameItem->text().isEmpty() ||
!mLayer->fields().exists( row ) ||
mLayer->fields().at( row ).name() == nameItem->text() )
!mLayer->fields().exists( idx ) ||
mLayer->fields().at( idx ).name() == nameItem->text() )
return;

mLayer->beginEditCommand( tr( "Rename attribute" ) );
if ( mLayer->renameAttribute( row, nameItem->text() ) )
if ( mLayer->renameAttribute( idx, nameItem->text() ) )
{
mLayer->endEditCommand();
}

0 comments on commit 9339615

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