[QGIS Commit] r11710 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Sep 25 04:27:39 EDT 2009


Author: mhugent
Date: 2009-09-25 04:27:38 -0400 (Fri, 25 Sep 2009)
New Revision: 11710

Modified:
   trunk/qgis/src/app/qgssearchquerybuilder.cpp
Log:
Do searches also on not-commited attributes

Modified: trunk/qgis/src/app/qgssearchquerybuilder.cpp
===================================================================
--- trunk/qgis/src/app/qgssearchquerybuilder.cpp	2009-09-24 19:27:53 UTC (rev 11709)
+++ trunk/qgis/src/app/qgssearchquerybuilder.cpp	2009-09-25 08:27:38 UTC (rev 11710)
@@ -60,7 +60,7 @@
 void QgsSearchQueryBuilder::populateFields()
 {
   QgsDebugMsg( "entering." );
-  const QgsFieldMap& fields = mLayer->dataProvider()->fields();
+  const QgsFieldMap& fields = mLayer->pendingFields();
   for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
   {
     QString fieldName = it->name();
@@ -91,15 +91,17 @@
 
 void QgsSearchQueryBuilder::getFieldValues( int limit )
 {
+  if ( !mLayer )
+  {
+    return;
+  }
   // clear the values list
   mModelValues->clear();
 
-  QgsVectorDataProvider* provider = mLayer->dataProvider();
-
   // determine the field type
   QString fieldName = mModelFields->data( lstFields->currentIndex() ).toString();
   int fieldIndex = mFieldMap[fieldName];
-  QgsField field = provider->fields()[fieldIndex];
+  QgsField field = mLayer->pendingFields()[fieldIndex];//provider->fields()[fieldIndex];
   bool numeric = ( field.type() == QVariant::Int || field.type() == QVariant::Double );
 
   QgsFeature feat;
@@ -108,14 +110,14 @@
   QgsAttributeList attrs;
   attrs.append( fieldIndex );
 
-  provider->select( attrs, QgsRectangle(), false );
+  mLayer->select( attrs, QgsRectangle(), false );
 
   lstValues->setCursor( Qt::WaitCursor );
   // Block for better performance
   mModelValues->blockSignals( true );
   lstValues->setUpdatesEnabled( false );
 
-  while ( provider->nextFeature( feat ) &&
+  while ( mLayer->nextFeature( feat ) &&
           ( limit == 0 || mModelValues->rowCount() != limit ) )
   {
     const QgsAttributeMap& attributes = feat.attributeMap();



More information about the QGIS-commit mailing list