Skip to content
Permalink
Browse files

[FEATURE] Possibility to search in attribute table within selected re…

…cords only.

git-svn-id: http://svn.osgeo.org/qgis/trunk@10792 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed May 14, 2009
1 parent 749390f commit 6b9697633c318192a1199a9c5cf23af0c818f391
Showing with 32 additions and 9 deletions.
  1. +25 −9 src/app/attributetable/qgsattributetabledialog.cpp
  2. +7 −0 src/ui/qgsattributetabledialog.ui
@@ -424,19 +424,35 @@ void QgsAttributeTableDialog::doSearch( QString searchString )
}

QApplication::setOverrideCursor( Qt::WaitCursor );

mSelectedFeatures.clear();
mLayer->select( mLayer->pendingAllAttributesList(), QgsRectangle(), false );

if ( cbxSearchSelectedOnly->isChecked() )
{
QgsFeatureList selectedFeatures = mLayer->selectedFeatures();
for (QgsFeatureList::ConstIterator it = selectedFeatures.begin(); it != selectedFeatures.end(); ++it)
{
if ( searchTree->checkAgainst( mLayer->pendingFields(), it->attributeMap() ) )
mSelectedFeatures << it->id();

QgsFeature f;
while ( mLayer->nextFeature( f ) )
// check if there were errors during evaluating
if ( searchTree->hasError() )
break;
}
}
else
{
if ( searchTree->checkAgainst( mLayer->pendingFields(), f.attributeMap() ) )
mSelectedFeatures << f.id();
mLayer->select( mLayer->pendingAllAttributesList(), QgsRectangle(), false );
QgsFeature f;

while ( mLayer->nextFeature( f ) )
{
if ( searchTree->checkAgainst( mLayer->pendingFields(), f.attributeMap() ) )
mSelectedFeatures << f.id();

// check if there were errors during evaluating
if ( searchTree->hasError() )
break;
// check if there were errors during evaluating
if ( searchTree->hasError() )
break;
}
}

QApplication::restoreOverrideCursor();
@@ -219,6 +219,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbxSearchSelectedOnly" >
<property name="text" >
<string>Search selected records only</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >

0 comments on commit 6b96976

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