Skip to content

Commit a38ce73

Browse files
committed
update columns list when attribute table updated
1 parent 1e2838f commit a38ce73

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/app/qgsattributetabledialog.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ void QgsAttributeTableDialog::columnBoxInit()
264264
QgsFieldMap fieldMap = mLayer->pendingFields();
265265
QgsFieldMap::Iterator it = fieldMap.begin();
266266

267+
mColumnBox->clear();
268+
267269
for ( ; it != fieldMap.end(); ++it )
268270
if ( mLayer->editType( it.key() ) != QgsVectorLayer::Hidden )
269271
mColumnBox->addItem( it.value().name() );
@@ -705,7 +707,8 @@ void QgsAttributeTableDialog::on_mAddAttribute_clicked()
705707
mLayer->destroyEditCommand();
706708
}
707709
// update model - a field has been added or updated
708-
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
710+
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );\
711+
columnBoxInit();
709712
}
710713
}
711714

@@ -747,6 +750,7 @@ void QgsAttributeTableDialog::on_mRemoveAttribute_clicked()
747750
}
748751
// update model - a field has been added or updated
749752
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
753+
columnBoxInit();
750754
}
751755
}
752756

@@ -760,6 +764,7 @@ void QgsAttributeTableDialog::on_mOpenFieldCalculator_clicked()
760764
if ( col >= 0 )
761765
{
762766
mModel->reload( mModel->index( 0, col ), mModel->index( mModel->rowCount() - 1, col ) );
767+
columnBoxInit();
763768
}
764769
}
765770
}

0 commit comments

Comments
 (0)