Skip to content
Permalink
Browse files

fix #1598

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10429 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Mar 27, 2009
1 parent 1f7c86b commit 3de73cc04e835286fb75071ea972fe4011f03e14
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/app/attributetable/BeataModel.cpp
@@ -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)));
@@ -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 )
{
@@ -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() );
}
}
@@ -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 );
}
@@ -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 )
@@ -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() )
{
@@ -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 )
@@ -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() )
{

0 comments on commit 3de73cc

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