Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix #1598
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10429 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Mar 27, 2009
1 parent 1f7c86b commit 3de73cc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/app/attributetable/BeataModel.cpp
Expand Up @@ -88,8 +88,8 @@ BeataModel::BeataModel( QgsVectorLayer *theLayer, QObject *parent )
mLastRow = NULL;
mLayer = theLayer;
mFeatureCount = mLayer->pendingFeatureCount();
mFieldCount = mLayer->dataProvider()->fieldCount();
mAttributes = mLayer->dataProvider()->attributeIndexes();
mFieldCount = mLayer->pendingFields().size();
mAttributes = mLayer->pendingAllAttributesList();

connect( mLayer, SIGNAL( layerModified( bool ) ), this, SLOT( layerModified( bool ) ) );
//connect(mLayer, SIGNAL(attributeAdded(int)), this, SLOT( attributeAdded(int)));
Expand Down Expand Up @@ -233,7 +233,7 @@ void BeataModel::loadLayer()

// not needed when we have featureAdded signal
mFeatureCount = mLayer->pendingFeatureCount();
mFieldCount = mLayer->dataProvider()->fieldCount();
mFieldCount = mLayer->pendingFields().size();

if ( ins )
{
Expand Down Expand Up @@ -324,7 +324,7 @@ QVariant BeataModel::headerData( int section, Qt::Orientation orientation, int r
}
else
{
QgsField field = mLayer->dataProvider()->fields()[section]; //column
QgsField field = mLayer->pendingFields()[ mAttributes[section] ]; //column
return QVariant( field.name() );
}
}
Expand All @@ -350,7 +350,7 @@ void BeataModel::sort( int column, Qt::SortOrder order )
row = f.attributeMap();

pair.id = f.id();
pair.columnItem = row[column];
pair.columnItem = row[ mAttributes[column] ];

mSortList.append( pair );
}
Expand Down Expand Up @@ -383,7 +383,7 @@ QVariant BeataModel::data( const QModelIndex &index, int role ) const
if ( !index.isValid() || ( role != Qt::TextAlignmentRole && role != Qt::DisplayRole && role != Qt::EditRole ) )
return QVariant();

QVariant::Type fldType = mLayer->dataProvider()->fields()[index.column()].type();
QVariant::Type fldType = mLayer->pendingFields()[ mAttributes[index.column()] ].type();
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double );

if ( role == Qt::TextAlignmentRole )
Expand All @@ -403,10 +403,10 @@ QVariant BeataModel::data( const QModelIndex &index, int role ) const
return QVariant( "ERROR" );

mLastRowId = rowToId( index.row() );
mLastRow = ( QgsAttributeMap * )( &( mFeat.attributeMap() ) );
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
}

QVariant& val = ( *mLastRow )[index.column()];
QVariant& val = ( *mLastRow )[ mAttributes[index.column()] ];

if ( val.isNull() )
{
Expand Down Expand Up @@ -512,7 +512,7 @@ QVariant BeataMemModel::data( const QModelIndex &index, int role ) const
if ( !index.isValid() || ( role != Qt::TextAlignmentRole && role != Qt::DisplayRole && role != Qt::EditRole ) )
return QVariant();

QVariant::Type fldType = mLayer->dataProvider()->fields()[index.column()].type();
QVariant::Type fldType = mLayer->pendingFields()[ mAttributes[index.column()] ].type();
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double );

if ( role == Qt::TextAlignmentRole )
Expand All @@ -534,10 +534,10 @@ QVariant BeataMemModel::data( const QModelIndex &index, int role ) const

mLastRowId = rowToId( index.row() );
mFeat = mFeatureMap[rowToId( index.row() )];
mLastRow = ( QgsAttributeMap * )( &( mFeat.attributeMap() ) );
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
}

QVariant& val = ( *mLastRow )[index.column()];
QVariant &val = ( *mLastRow )[ mAttributes[index.column()] ];

if ( val.isNull() )
{
Expand Down

0 comments on commit 3de73cc

Please sign in to comment.