Skip to content

Commit

Permalink
Do searches also on not-commited attributes
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@11710 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Sep 25, 2009
1 parent 0f23b74 commit b723e90
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/app/qgssearchquerybuilder.cpp
Expand Up @@ -60,7 +60,7 @@ QgsSearchQueryBuilder::~QgsSearchQueryBuilder()
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();
Expand Down Expand Up @@ -91,15 +91,17 @@ void QgsSearchQueryBuilder::setupListViews()

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;
Expand All @@ -108,14 +110,14 @@ void QgsSearchQueryBuilder::getFieldValues( int limit )
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();
Expand Down

0 comments on commit b723e90

Please sign in to comment.