Skip to content
Permalink
Browse files

fix #2549

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13310 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Apr 14, 2010
1 parent c71921a commit ab23779f8b9d206c21cb4dee4623173a7bb9af29
Showing with 17 additions and 18 deletions.
  1. +17 −18 src/app/attributetable/qgsattributetablemodel.cpp
@@ -137,23 +137,8 @@ void QgsAttributeTableModel::loadAttributes()
}

bool ins = false, rm = false;
int pendingFieldCount = mLayer->pendingFields().size();

if ( mFieldCount < pendingFieldCount )
{
ins = true;
beginInsertColumns( QModelIndex(), mFieldCount, pendingFieldCount - 1 );
}
else if ( pendingFieldCount < mFieldCount )
{
rm = true;
beginRemoveColumns( QModelIndex(), pendingFieldCount, mFieldCount - 1 );
}

mFieldCount = 0;
mAttributes.clear();
mValueMaps.clear();

QgsAttributeList attributes;
for ( QgsFieldMap::const_iterator it = mLayer->pendingFields().constBegin(); it != mLayer->pendingFields().end(); it++ )
{
switch ( mLayer->editType( it.key() ) )
@@ -169,10 +154,24 @@ void QgsAttributeTableModel::loadAttributes()
break;
}

mFieldCount++;
mAttributes << it.key();
attributes << it.key();
}

if ( mFieldCount < attributes.size() )
{
ins = true;
beginInsertColumns( QModelIndex(), mFieldCount, attributes.size() - 1 );
}
else if ( attributes.size() < mFieldCount )
{
rm = true;
beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount - 1 );
}

mFieldCount = attributes.size();
mAttributes = attributes;
mValueMaps.clear();

if ( ins )
{
endInsertColumns();

0 comments on commit ab23779

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