Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FEATURE] Possibility to search in attribute table within selected re…
…cords only.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10792 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 14, 2009
1 parent 320daa3 commit 783b8cb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/app/attributetable/qgsattributetabledialog.cpp
Expand Up @@ -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();
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsattributetabledialog.ui
Expand Up @@ -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" >
Expand Down

0 comments on commit 783b8cb

Please sign in to comment.