Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
update columns list when attribute table updated
  • Loading branch information
alexbruy committed Aug 18, 2012
1 parent 1e2838f commit a38ce73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/qgsattributetabledialog.cpp
Expand Up @@ -264,6 +264,8 @@ void QgsAttributeTableDialog::columnBoxInit()
QgsFieldMap fieldMap = mLayer->pendingFields();
QgsFieldMap::Iterator it = fieldMap.begin();

mColumnBox->clear();

for ( ; it != fieldMap.end(); ++it )
if ( mLayer->editType( it.key() ) != QgsVectorLayer::Hidden )
mColumnBox->addItem( it.value().name() );
Expand Down Expand Up @@ -705,7 +707,8 @@ void QgsAttributeTableDialog::on_mAddAttribute_clicked()
mLayer->destroyEditCommand();
}
// update model - a field has been added or updated
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );\
columnBoxInit();
}
}

Expand Down Expand Up @@ -747,6 +750,7 @@ void QgsAttributeTableDialog::on_mRemoveAttribute_clicked()
}
// update model - a field has been added or updated
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
columnBoxInit();
}
}

Expand All @@ -760,6 +764,7 @@ void QgsAttributeTableDialog::on_mOpenFieldCalculator_clicked()
if ( col >= 0 )
{
mModel->reload( mModel->index( 0, col ), mModel->index( mModel->rowCount() - 1, col ) );
columnBoxInit();
}
}
}
Expand Down

0 comments on commit a38ce73

Please sign in to comment.