[QGIS Commit] r10429 - trunk/qgis/src/app/attributetable

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Mar 27 13:42:35 EDT 2009


Author: jef
Date: 2009-03-27 13:42:35 -0400 (Fri, 27 Mar 2009)
New Revision: 10429

Modified:
   trunk/qgis/src/app/attributetable/BeataModel.cpp
Log:
fix #1598

Modified: trunk/qgis/src/app/attributetable/BeataModel.cpp
===================================================================
--- trunk/qgis/src/app/attributetable/BeataModel.cpp	2009-03-27 17:41:06 UTC (rev 10428)
+++ trunk/qgis/src/app/attributetable/BeataModel.cpp	2009-03-27 17:42:35 UTC (rev 10429)
@@ -88,8 +88,8 @@
   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 @@
 
   // not needed when we have featureAdded signal
   mFeatureCount = mLayer->pendingFeatureCount();
-  mFieldCount = mLayer->dataProvider()->fieldCount();
+  mFieldCount = mLayer->pendingFields().size();
 
   if ( ins )
   {
@@ -324,7 +324,7 @@
     }
     else
     {
-      QgsField field = mLayer->dataProvider()->fields()[section]; //column
+      QgsField field = mLayer->pendingFields()[ mAttributes[section] ]; //column
       return QVariant( field.name() );
     }
   }
@@ -350,7 +350,7 @@
     row = f.attributeMap();
 
     pair.id = f.id();
-    pair.columnItem = row[column];
+    pair.columnItem = row[ mAttributes[column] ];
 
     mSortList.append( pair );
   }
@@ -383,7 +383,7 @@
   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 @@
       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 @@
   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 @@
 
     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() )
   {



More information about the QGIS-commit mailing list