[QGIS Commit] r14061 - in branches/threading-branch/src/app: . attributetable

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Aug 11 11:41:58 EDT 2010


Author: wonder
Date: 2010-08-11 15:41:58 +0000 (Wed, 11 Aug 2010)
New Revision: 14061

Modified:
   branches/threading-branch/src/app/attributetable/qgsattributetabledialog.cpp
   branches/threading-branch/src/app/attributetable/qgsattributetablememorymodel.cpp
   branches/threading-branch/src/app/attributetable/qgsattributetablemodel.cpp
   branches/threading-branch/src/app/qgisapp.cpp
Log:
Adapt attribute table to use QgsFeatureIterator, allow opening it while rendering


Modified: branches/threading-branch/src/app/attributetable/qgsattributetabledialog.cpp
===================================================================
--- branches/threading-branch/src/app/attributetable/qgsattributetabledialog.cpp	2010-08-11 14:32:24 UTC (rev 14060)
+++ branches/threading-branch/src/app/attributetable/qgsattributetabledialog.cpp	2010-08-11 15:41:58 UTC (rev 14061)
@@ -571,10 +571,10 @@
   }
   else
   {
-    mLayer->select( mLayer->pendingAllAttributesList(), QgsRectangle(), fetchGeom );
+    QgsFeatureIterator fi = mLayer->getFeatures( mLayer->pendingAllAttributesList(), QgsRectangle(), fetchGeom );
     QgsFeature f;
 
-    while ( mLayer->nextFeature( f ) )
+    while ( fi.nextFeature( f ) )
     {
       if ( searchTree->checkAgainst( mLayer->pendingFields(), f.attributeMap(), f.geometry() ) )
         mSelectedFeatures << f.id();

Modified: branches/threading-branch/src/app/attributetable/qgsattributetablememorymodel.cpp
===================================================================
--- branches/threading-branch/src/app/attributetable/qgsattributetablememorymodel.cpp	2010-08-11 14:32:24 UTC (rev 14060)
+++ branches/threading-branch/src/app/attributetable/qgsattributetablememorymodel.cpp	2010-08-11 15:41:58 UTC (rev 14061)
@@ -30,12 +30,12 @@
 void QgsAttributeTableMemoryModel::loadLayer()
 {
   QgsAttributeTableModel::loadLayer();
-  mLayer->select( mLayer->pendingAllAttributesList(), QgsRectangle(), false );
+  QgsFeatureIterator fi = mLayer->getFeatures( mLayer->pendingAllAttributesList(), QgsRectangle(), false );
 
   mFeatureMap.reserve( mLayer->pendingFeatureCount() + 50 );
 
   QgsFeature f;
-  while ( mLayer->nextFeature( f ) )
+  while ( fi.nextFeature( f ) )
     mFeatureMap.insert( f.id(), f );
 }
 

Modified: branches/threading-branch/src/app/attributetable/qgsattributetablemodel.cpp
===================================================================
--- branches/threading-branch/src/app/attributetable/qgsattributetablemodel.cpp	2010-08-11 14:32:24 UTC (rev 14060)
+++ branches/threading-branch/src/app/attributetable/qgsattributetablemodel.cpp	2010-08-11 15:41:58 UTC (rev 14061)
@@ -220,9 +220,9 @@
       rect = QgisApp::instance()->mapCanvas()->extent();
     }
 
-    mLayer->select( mAttributes, rect, false );
+    QgsFeatureIterator fi = mLayer->getFeatures( mAttributes, rect, false );
 
-    for ( int i = 0; mLayer->nextFeature( f ); ++i )
+    for ( int i = 0; fi.nextFeature( f ); ++i )
     {
       mRowIdMap.insert( i, f.id() );
       mIdRowMap.insert( f.id(), i );
@@ -356,8 +356,8 @@
 // QgsDebugMsg("SORTing");
 
   mSortList.clear();
-  mLayer->select( attrs, QgsRectangle(), false );
-  while ( mLayer->nextFeature( f ) )
+  QgsFeatureIterator fi = mLayer->getFeatures( attrs, QgsRectangle(), false );
+  while ( fi.nextFeature( f ) )
   {
     row = f.attributeMap();
     mSortList.append( QgsAttributeTableIdColumnPair( f.id(), row[ mAttributes[column] ] ) );

Modified: branches/threading-branch/src/app/qgisapp.cpp
===================================================================
--- branches/threading-branch/src/app/qgisapp.cpp	2010-08-11 14:32:24 UTC (rev 14060)
+++ branches/threading-branch/src/app/qgisapp.cpp	2010-08-11 15:41:58 UTC (rev 14061)
@@ -3716,11 +3716,6 @@
 
 void QgisApp::attributeTable()
 {
-  if ( mMapCanvas && mMapCanvas->isDrawing() )
-  {
-    return;
-  }
-
   QgsVectorLayer *myLayer = qobject_cast<QgsVectorLayer *>( activeLayer() );
   if ( !myLayer )
   {



More information about the QGIS-commit mailing list